Skip to content

feat(deploy): add SPA fallback redirect for Cloudflare Pages#5

Merged
karngyan merged 1 commit into
mainfrom
feat/deploy-spa-fallback
May 1, 2026
Merged

feat(deploy): add SPA fallback redirect for Cloudflare Pages#5
karngyan merged 1 commit into
mainfrom
feat/deploy-spa-fallback

Conversation

@karngyan

@karngyan karngyan commented May 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds public/_redirects so Cloudflare Pages serves index.html (200) for any path that doesn't match a real file. Without this, deep links like /preview/<id> return a literal 404 because Pages looks for a file at that path before falling back to SPA routing.

Real files (templates.json, _headers, assets/*) are still served before the redirect runs, so static assets and the manifest are unaffected.

Re-applies fb15c80, which was accidentally pushed direct to main earlier in the session; main was reverted in 3aa3fff so this PR re-introduces the change cleanly.

Test plan

  • pnpm build — confirmed dist/_redirects is emitted
  • After deploy: curl -I https://resumex.karnstack.com/preview/minimal-mono returns 200
  • After deploy: curl -I https://resumex.karnstack.com/templates.json still serves the manifest (file beats redirect)
  • After deploy: home / still redirects to GitHub (public mode beforeLoad)

🤖 Generated with Claude Code

Without this, deep links like /preview/<id> return 404 because Pages
looks for a literal file. The wildcard rewrite to /index.html lets
TanStack Router handle routing client-side. Real files (templates.json,
assets, etc.) are still served before the redirect runs.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented May 1, 2026

Copy link
Copy Markdown
Contributor

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
❌ Deployment failed
View logs
resumex 269fd87 May 01 2026, 09:34 PM

@karngyan karngyan merged commit 5c99bbf into main May 1, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant