Infrastructure & DevOps
Migrating a Full-Stack Portfolio from Netlify to Cloudflare Pages & Supabase
Preserving routes, SEO canonicals, and edge HTML rendering during a platform migration

Summary: Engineering notes on migrating a multi-entry Vite portfolio with dynamic project/activity pages from Netlify to Cloudflare Pages Functions and Supabase PostgreSQL.
Why the Migration Was Necessary
When a static hosting provider hits credit or build limits, an entire personal site can go offline with HTTP 503. Moving the active production platform to Cloudflare Pages paired with Cloudflare Pages Functions and Supabase PostgreSQL separates static CDN asset delivery from lightweight edge SSR.
Edge Routing Architecture
Rather than serving an empty <div id="root"></div> shell to crawlers on dynamic routes, Cloudflare Pages Functions under functions/ intercept HTML document routes:
/servesindex.htmlenriched at the edge with live metadata and JSON-LD@graphmarkup./projects/:slugand/activities/:slugquery Supabase REST directly overfetch(), inject page-specific<title>,<meta name="description">, canonical URLs,<noscript>fallbacks, and return trueHTTP 404when a slug does not exist or is unpublished./sitemap.xmland/robots.txtare generated dynamically so preview deployments (*.pages.dev) automatically carryX-Robots-Tag: noindex, nofollowandDisallow: /.
Avoiding Cloudflare 308 Redirect Loops
During migration, legacy Netlify _redirects rules caused infinite 308 loops on Cloudflare Pages. Enforcing a build-time verification check (scripts/ci/verify-dist.mjs) that forbids dist/_redirects and verifies canonical links on every build prevents regressions before deployment.
Preserving Legacy Search Signals
Once the paused legacy Netlify origin (thushanrathnayaka.netlify.app) is restored via support, an isolated migration/netlify-seo-redirect deployment is prepared to serve path-preserving HTTP 301 redirects to https://thushanrathnayaka.com/.