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:

  1. Actually free – No surprise pauses or hidden limits
  2. Fast builds – My Astro site should build in seconds
  3. Easy GitHub integration – Push to deploy
  4. 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:

FeatureNetlifyCloudflare Pages
Bandwidth100GB/monthUnlimited
Build minutes300/month500/month
Concurrent builds11
SitesUnlimitedUnlimited
Custom domainsYesYes
SSLYesYes

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:

  1. Click ”+ Add”“Connect a domain”
  2. Enter your domain (e.g., yourdomain.com)
  3. Select “Quick scan for DNS records” – Cloudflare will import your existing records
  4. Choose the Free plan
  5. Cloudflare will give you two nameservers (something like adam.ns.cloudflare.com and bella.ns.cloudflare.com)

Step 3: Update Nameservers at Your Registrar

I use Namecheap, but the process is similar for other registrars.

In Namecheap:

  1. Log in → Domain ListManage your domain
  2. Find the Nameservers section
  3. Change from “Namecheap BasicDNS” to “Custom DNS”
  4. Enter both Cloudflare nameservers
  5. 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:

  1. In Cloudflare dashboard, click ”+ Add”“Pages”
  2. Select “Connect to Git” and authorize GitHub
  3. Choose your repository
  4. Configure build settings:
SettingValue
Build commandnpm run build
Build output directorydist
Environment variableNODE_VERSION = 20
  1. 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):

  1. Go to your Pages project → “Custom domains” tab
  2. Click “Set up a custom domain”
  3. Add both yourdomain.com and www.yourdomain.com
  4. 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:

public/_headers
/*
Cache-Control: public, max-age=0, must-revalidate
/_astro/*
Cache-Control: public, max-age=31536000, immutable

This tells browsers to always revalidate HTML pages but cache Astro’s hashed assets forever.

Step 7: Clean Up

Once everything is working:

  1. Delete your netlify.toml file – you don’t need it anymore
  2. Delete (or pause) your site on Netlify
  3. Purge Cloudflare’s cache if you see old content: CachingConfiguration“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:

  1. Go to your domain in Cloudflare → CachingConfiguration
  2. 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 100GBUnlimited bandwidth
Worried about traffic spikesTraffic 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/_headers for cache rules
  • Delete netlify.toml
  • Purge Cloudflare cache
  • Delete Netlify project

Welcome to unlimited bandwidth. Your site will thank you.