Skip to main content

Migrating from Netlify to Cloudflare Pages: Done in 10 Minutes

Ryan Dahlberg
Ryan Dahlberg
December 13, 2025 7 min read
Share:
Migrating from Netlify to Cloudflare Pages: Done in 10 Minutes

TL;DR

We just migrated two production websites (blog and portfolio) from Netlify to Cloudflare Pages in 10 minutes with zero downtime. The process was surprisingly smooth, and the benefits are already showing.

What we gained:

  • 🚀 Better Performance - Global edge network with 300+ data centers
  • 💰 Unlimited Bandwidth - No more bandwidth limits or overages
  • 🔒 Enterprise-grade DDoS Protection - Built-in security at the edge
  • Faster Builds - Improved build times
  • 🎯 Integrated DNS - Everything in one dashboard
  • 📊 Better Analytics - Cloudflare Web Analytics included

Time Investment: 10 minutes Downtime: 0 seconds Complexity: Ridiculously easy


Why We Moved

Don’t get me wrong—Netlify is a fantastic platform. We’ve been using it for years and it’s served us well. But as our traffic grew and we started consolidating our infrastructure under Cloudflare (DNS, CDN, WAF), it made sense to move our hosting there too.

The catalysts:

  1. Bandwidth limits - Netlify’s free tier has limits that we were approaching
  2. Consolidation - DNS, CDN, and analytics were already on Cloudflare
  3. Performance - Cloudflare’s global network is hard to beat
  4. Cost optimization - Free unlimited bandwidth is compelling

The Migration Process

What We Migrated:

Blog (ry-ops.dev)

  • Framework: Astro 5.16.1
  • Custom headers for security
  • Automatic deployments from GitHub

Portfolio (ryandahlberg.com)

  • Framework: Gatsby 5.14.5
  • Automatic deployments from GitHub

Step 1: Connect GitHub (1 minute)

Since Cloudflare already had access to our GitHub account, this was just a matter of ensuring the specific repositories were accessible:

GitHub Settings Applications Cloudflare Pages
 Configure Grant access to repositories

Step 2: Create Cloudflare Pages Projects (2 minutes)

Using the Cloudflare API, we created both projects with the correct build configurations:

Blog Configuration:

{
  "name": "blog",
  "production_branch": "main",
  "build_config": {
    "build_command": "npm run build",
    "destination_dir": "dist"
  }
}

Portfolio Configuration:

{
  "name": "cara",
  "production_branch": "master",
  "build_config": {
    "build_command": "npm run build",
    "destination_dir": "public"
  }
}

Step 3: Trigger Initial Deployments (5 minutes)

Both sites built successfully on the first try. No build configuration tweaks needed. No environment variable headaches. Just worked.

Blog: Built in ~2 minutes Portfolio: Built in ~3 minutes

Step 4: Configure Custom Domains (1 minute)

Added custom domains via API:

  • ry-ops.dev → blog project
  • ryandahlberg.com → portfolio project

Step 5: Update DNS (1 minute)

Since both domains were already in Cloudflare DNS, this was just updating two CNAME records:

ry-ops.dev → blog-5f3.pages.dev (Proxied)
ryandahlberg.com → cara-aeq.pages.dev (Proxied)

DNS propagated instantly since everything was already in Cloudflare.

Step 6: Verification (30 seconds)

Both sites were immediately accessible:

  • ✅ Custom domains working
  • ✅ SSL/TLS certificates auto-provisioned
  • ✅ Security headers preserved
  • ✅ HTTP/2 enabled
  • ✅ Everything just… worked

What Surprised Us

1. Zero Build Configuration Issues

Both Astro and Gatsby projects built perfectly on the first try. No package.json tweaks, no build command adjustments, no environment variable hunting.

2. Instant DNS Propagation

Because both domains were already using Cloudflare DNS, the cutover was instant. No waiting for TTLs to expire, no gradual rollout needed.

3. Headers Just Worked

Our custom _headers file for the blog (CSP, security headers, cache control) was automatically respected by Cloudflare Pages. No migration or reconfiguration needed.

4. Better Build Times

The blog build went from ~3-4 minutes on Netlify to ~2 minutes on Cloudflare Pages. Not a huge difference, but noticeable.


The Technical Details

What Cloudflare Pages Handles Automatically:

SSL/TLS Certificates - Auto-provisioned and renewed ✅ HTTP/2 & HTTP/3 - Enabled by default ✅ Brotli Compression - Automatic ✅ DDoS Protection - Enterprise-grade, always on ✅ Preview Deployments - For pull requests ✅ Atomic Deployments - Zero-downtime deploys ✅ Edge Caching - Global CDN with 300+ locations

Custom Headers Configuration

Our _headers file was preserved exactly as-is:

/*
  Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-inline'...
  X-Frame-Options: DENY
  X-Content-Type-Options: nosniff
  Strict-Transport-Security: max-age=31536000; includeSubDomains; preload

/_astro/*
  Cache-Control: public, max-age=31536000, immutable

All headers were respected without any modifications.

Automatic Deployments

Cloudflare Pages now watches our GitHub repositories:

  • Push to main (blog) or master (portfolio) → Automatic production deploy
  • Open a PR → Automatic preview deployment
  • Comment on PR → Preview URL posted automatically

Performance Comparison

Before (Netlify):

  • Build time: ~3-4 minutes
  • Edge locations: Global CDN
  • Bandwidth: Limited on free tier
  • TTFB: ~150ms (US East)

After (Cloudflare Pages):

  • Build time: ~2 minutes (20-30% faster)
  • Edge locations: 300+ data centers
  • Bandwidth: Unlimited
  • TTFB: ~80ms (US East, 47% improvement)

The TTFB improvement is particularly noticeable because our DNS was already on Cloudflare—eliminating the extra hop.


Cost Analysis

Netlify Pricing:

  • Free tier: 100GB bandwidth/month
  • Pro tier: $19/month for 1TB bandwidth
  • We were approaching the 100GB limit

Cloudflare Pages Pricing:

  • Free tier: Unlimited bandwidth, unlimited sites
  • No paid tier needed for our use case

Annual Savings: $228/year (if we had upgraded to Pro)


What We Learned

1. Infrastructure Consolidation is Powerful

Having DNS, CDN, hosting, and analytics all in one platform simplifies operations dramatically. One dashboard, one API, one mental model.

2. Migration Doesn’t Have to Be Scary

With proper planning and the right tools, even production migrations can be smooth and incredibly fast. We had zero downtime and zero user impact.

3. The Modern Web Platform is Amazing

Both Netlify and Cloudflare Pages offer incredible developer experiences. The fact that we could migrate two production sites in 10 minutes speaks to how mature these platforms have become.

4. API-First is the Way

We did this entire migration via API (with Claude Code’s help). Automation made it repeatable, documentable, and stress-free.


Gotchas We Encountered (and Solved)

Issue 1: Branch Name Mismatch

The portfolio used master instead of main. Easy fix via API:

PATCH /pages/projects/cara
{ "production_branch": "master" }

Issue 2: DNS Validation Timing

The custom domains needed the DNS records to exist before they’d validate. Solution: Update DNS first, then trigger validation retry.

That’s it. Those were the only two “issues” we encountered.


The Migration Checklist

If you’re considering a similar migration, here’s the exact process:

Pre-Migration:

  • Audit current build configurations
  • Document environment variables
  • Note custom headers/redirects
  • Identify branch names

Migration:

  • Connect GitHub to Cloudflare Pages
  • Create Pages projects with build configs
  • Add custom domains
  • Update DNS records (CNAME to Pages subdomain)
  • Verify SSL/TLS certificates auto-provision
  • Test sites thoroughly

Post-Migration:

  • Monitor first few automatic deployments
  • Verify analytics are tracking
  • Clean up old Netlify sites
  • Update documentation

Should You Migrate?

Migrate to Cloudflare Pages if:

  • ✅ You’re already using Cloudflare for DNS
  • ✅ You want unlimited bandwidth
  • ✅ You value infrastructure consolidation
  • ✅ You need global edge performance
  • ✅ You’re hitting Netlify’s bandwidth limits

Stay on Netlify if:

  • ✅ You use Netlify-specific features (Forms, Functions, Identity)
  • ✅ You’re happy with current performance
  • ✅ You’re well within bandwidth limits
  • ✅ You prefer Netlify’s dashboard UX

For us, Cloudflare Pages was the clear winner. But both are excellent platforms.


The Bottom Line

Time invested: 10 minutes Downtime: 0 seconds Build failures: 0 Configuration changes needed: 1 (branch name) Performance improvement: 47% faster TTFB Cost savings: $228/year Complexity: Ridiculously low

Would we do it again? In a heartbeat.


Try It Yourself

Both platforms offer generous free tiers, so you can test the migration without risk:

Cloudflare Pages:

  • Unlimited bandwidth
  • Unlimited sites
  • Automatic SSL
  • 500 builds/month free tier

What’s Next: We’re exploring Cloudflare Pages Functions (their edge compute platform) to add dynamic features without a separate backend. More on that soon.


Questions? Have you migrated between hosting platforms recently? Share your experience in the comments or open a discussion.

Want to try it? Check out the Cloudflare Pages documentation to get started.


Migration completed with Claude Code - making infrastructure automation accessible and repeatable.

#infrastructure #scalability #migration #DevOps #Cloudflare #CDN #Web Performance