Skip to content

Serve SPA routes as HTTP 200 on Cloudflare Pages - #21

Merged
csfh merged 2 commits into
mainfrom
cursor/spa-redirects-200-d096
Aug 16, 2026
Merged

Serve SPA routes as HTTP 200 on Cloudflare Pages#21
csfh merged 2 commits into
mainfrom
cursor/spa-redirects-200-d096

Conversation

@csfh

@csfh csfh commented Aug 16, 2026

Copy link
Copy Markdown
Owner

Summary

xo.run is a Vite SPA on Cloudflare Pages. Unknown paths currently fall through to 404.html, so browsers recover via the client router while crawlers and curl see HTTP 404.

This adds the standard Pages rewrite in www/public/_redirects:

/*    /index.html   200

Existing static files still win. The older 404.html bounce stays for hosts that still serve a 404 fallback. A small site test checks that the rewrite is present.

Fixes #20

Checklist

  • Focused tests added or updated where behavior changed
  • Echo 2026 (echo26 / e26) updated if language or runtime surface changed
  • Examples updated if user-runnable demos are affected
  • Docs updated for durable or user-visible rules
  • scripts/gate changed (and echo26 when applicable) pass locally
Open in Web Open in Cursor 

@csfh
csfh marked this pull request as ready for review August 16, 2026 04:42
@cursor

cursor Bot commented Aug 16, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 16, 2026

Copy link
Copy Markdown

Deploying echo with  Cloudflare Pages  Cloudflare Pages

Latest commit: 304fd22
Status: ✅  Deploy successful!
Preview URL: https://41dddc70.echo-1gc.pages.dev
Branch Preview URL: https://cursor-spa-redirects-200-d09.echo-1gc.pages.dev

View logs

Add a _redirects 200 rewrite so crawlers and curl see live pages
instead of the 404.html fallback. Browsers already recovered.

Fixes #20

Co-authored-by: Christoffer Hallas <github@christofferhallas.com>
@cursor
cursor Bot force-pushed the cursor/spa-redirects-200-d096 branch from fbbb426 to abe0127 Compare August 16, 2026 06:26
@csfh
csfh merged commit 207af6e into main Aug 16, 2026
2 checks passed
@csfh
csfh deleted the cursor/spa-redirects-200-d096 branch September 8, 2026 17:31
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.

Optional: serve SPA routes as HTTP 200 for crawlers

2 participants