How I migrated from Netlify to Cloudflare Pages (and why you should too)
A step-by-step guide on migrating your static site from Netlify to Cloudflare Pages. Learn how to set up Cloudflare DNS, configure your domain, and avoid the surprise billing that caught me off guard.
I woke up to an email that no developer wants to see: “Your site has been paused due to usage limits.” My blog was down, and Netlify wanted me to upgrade to their $19/month plan.
Wait, what? I chose Netlify specifically because it was supposed to be free for personal projects. Turns out their “free tier” has limits that can sneak up on you – 100GB bandwidth and 300 build minutes per month. A traffic spike or a bot crawling your site aggressively, and suddenly you’re locked out.
So I did what any frustrated developer would do: I migrated to Cloudflare Pages. And I’m not looking back.
Why Cloudflare Pages?
When looking for alternatives, I had a few requirements:
- Actually free – No surprise pauses or hidden limits
- Fast builds – My Astro site should build in seconds
- Easy GitHub integration – Push to deploy
- Custom domain support – With automatic SSL
Cloudflare Pages checks all these boxes. The killer feature? Unlimited bandwidth on the free tier. No more worrying about traffic spikes taking down my site.
Here’s how the free tiers compare:
| Feature | Netlify | Cloudflare Pages |
|---|---|---|
| Bandwidth | 100GB/month | Unlimited |
| Build minutes | 300/month | 500/month |
| Concurrent builds | 1 | 1 |
| Sites | Unlimited | Unlimited |
| Custom domains | Yes | Yes |
| SSL | Yes | Yes |
The bandwidth difference alone makes Cloudflare the clear winner for content sites.
The Migration Process
Here’s the step-by-step process I followed. The whole thing took about 30 minutes, with most of that being DNS propagation time.
Step 1: Create a Cloudflare Account
Head to dash.cloudflare.com and sign up. It’s free.
Step 2: Add Your Domain to Cloudflare
This is the key step that makes everything else seamless. Instead of just using Cloudflare Pages, you’ll also use Cloudflare DNS. This gives you:
- Automatic SSL certificate management
- Cloudflare’s CDN and DDoS protection
- Seamless integration with Pages
In the Cloudflare dashboard:
- Click ”+ Add” → “Connect a domain”
- Enter your domain (e.g.,
yourdomain.com) - Select “Quick scan for DNS records” – Cloudflare will import your existing records
- Choose the Free plan
- Cloudflare will give you two nameservers (something like
adam.ns.cloudflare.comandbella.ns.cloudflare.com)
Step 3: Update Nameservers at Your Registrar
I use Namecheap, but the process is similar for other registrars.
In Namecheap:
- Log in → Domain List → Manage your domain
- Find the Nameservers section
- Change from “Namecheap BasicDNS” to “Custom DNS”
- Enter both Cloudflare nameservers
- Save
DNS propagation can take anywhere from a few minutes to 48 hours. In my experience, it usually takes 1-2 hours.
Step 4: Deploy to Cloudflare Pages
While DNS is propagating, set up your Pages project:
- In Cloudflare dashboard, click ”+ Add” → “Pages”
- Select “Connect to Git” and authorize GitHub
- Choose your repository
- Configure build settings:
| Setting | Value |
|---|---|
| Build command | npm run build |
| Build output directory | dist |
| Environment variable | NODE_VERSION = 20 |
- Click “Save and Deploy”
Cloudflare will build your site and give you a preview URL like your-project.pages.dev.
Step 5: Connect Your Custom Domain
Once DNS has propagated (you’ll see “Active” status on your domain in Cloudflare):
- Go to your Pages project → “Custom domains” tab
- Click “Set up a custom domain”
- Add both
yourdomain.comandwww.yourdomain.com - Cloudflare automatically configures the DNS records and provisions SSL
That’s it. Your site is now live on Cloudflare Pages.
Step 6: Add Cache Headers (Optional)
If you had custom headers in your netlify.toml, you’ll want to replicate them. Create a public/_headers file:
/* Cache-Control: public, max-age=0, must-revalidate
/_astro/* Cache-Control: public, max-age=31536000, immutableThis tells browsers to always revalidate HTML pages but cache Astro’s hashed assets forever.
Step 7: Clean Up
Once everything is working:
- Delete your
netlify.tomlfile – you don’t need it anymore - Delete (or pause) your site on Netlify
- Purge Cloudflare’s cache if you see old content: Caching → Configuration → “Purge Everything”
Gotchas I Encountered
Old Content Showing Up
After migration, I saw my old Gatsby design on some pages. This was Cloudflare’s edge cache serving stale content. The fix:
- Go to your domain in Cloudflare → Caching → Configuration
- Click “Purge Everything”
SSL Errors on .pages.dev
The .pages.dev preview URL showed SSL errors for me initially. Don’t panic – this is a temporary certificate provisioning issue. Your custom domain should work fine. The preview URL will sort itself out.
DNS Propagation Delays
If your site shows a 522 error or the old Netlify “site paused” message, DNS is still propagating. Give it time. You can check propagation status at dnschecker.org.
The Results
The migration was painless, and now I have:
- Unlimited bandwidth – No more surprise pauses
- Faster edge network – Cloudflare’s CDN is everywhere
- Free SSL – Automatically managed
- Simple dashboard – Less cluttered than Netlify’s
| Before (Netlify) | After (Cloudflare) |
|---|---|
| Site paused at 100GB | Unlimited bandwidth |
| Worried about traffic spikes | Traffic spikes? Bring them on |
| $19/month to continue | $0/month forever |
Should You Migrate?
If you have a static site (blog, portfolio, docs) and you’re on Netlify’s free tier, yes. The migration is straightforward, and Cloudflare’s unlimited bandwidth means you’ll never get that dreaded “site paused” email.
If you’re using Netlify’s serverless functions heavily or depend on specific Netlify features like Forms or Identity, do your research first. Cloudflare has equivalents (Workers, Pages Functions) but they work differently.
For me, it was a no-brainer. My site is back online, it’s faster, and I’m not paying anything. That’s the way hosting should be.
Quick Migration Checklist
For those who want the TL;DR:
- Create Cloudflare account
- Add domain to Cloudflare DNS
- Update nameservers at your registrar
- Create Cloudflare Pages project
- Connect GitHub repo with build settings
- Add custom domains in Pages settings
- Create
public/_headersfor cache rules - Delete
netlify.toml - Purge Cloudflare cache
- Delete Netlify project
Welcome to unlimited bandwidth. Your site will thank you.