Skip to content

fix: enable SPA fallback for client-side routing - #19

Open
numb86 wants to merge 1 commit into
compio-rs:mainfrom
numb86:spa-fallback
Open

numb86 wants to merge 1 commit into
compio-rs:mainfrom
numb86:spa-fallback

Conversation

@numb86

@numb86 numb86 commented Sep 24, 2026

Copy link
Copy Markdown

Currently, you cannot access any pages except through the homepage at https://compio.rs .
For example, attempting to open the following link results in a 404 error:
https://compio.rs/docs/preface

The issue was caused by the lack of a fallback configuration for the SPA, fixed.

How to Set Up SPA Fallback in Cloudflare Workers.
https://developers.cloudflare.com/workers/static-assets/routing/single-page-application/

compatibility_date seems like it should use the creation date.
https://developers.cloudflare.com/workers/configuration/compatibility-dates/

How to Verify Locally

When running the following commands on the main branch to access http://localhost:8787/docs/preface, you would receive a 404 error:

$ pnpm build
$ pnpm dlx wrangler@4.65.0 dev --assets ./dist

After applying fixes, running $ pnpm dlx wrangler@4.65.0 dev will now allow you to access http://localhost:8787/docs/preface.

Additionally, accessing non-existent pages (e.g., http://localhost:8787/no-such-path ) will still display the 404 error, but the error page will be slightly more enhanced.

before after
スクリーンショット 2026-09-24 9 54 57 スクリーンショット 2026-09-24 2 48 34

This branch has not been deployed

No deployments
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