Skip to content

fix(routing): serve static files that a rewrite points to - #512

Merged
cpojer merged 1 commit into
voidzero-dev:mainfrom
meganemura:fix/rewrite-to-asset
Oct 21, 2026
Merged

cpojer merged 1 commit into
voidzero-dev:mainfrom
meganemura:fix/rewrite-to-asset

Conversation

@meganemura

Copy link
Copy Markdown
Contributor

A rewrite to a static file returns 404 when the app has no Pages, no fallback rules and no header rules. For example, /t/:id rewritten to /app.html in public/.

A rewrite dispatches its destination back into the generated app. In that setup the app has no not-found handler, so nothing asks ASSETS for /app.html, and Hono answers 404.

This change also adds the not-found handler when there is a rewrite (a redirect rule with status 200). Apps with only 3xx redirects are not affected.

A new test in compile.test.ts fails on main and passes with this change.

Without Pages or fallback rules, the generated app had no not-found
handler, so a 200 rewrite to a file in public/ returned 404.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CZxFCFRcYc9ojkUsSvuz5j

@cpojer cpojer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@cpojer
cpojer merged commit a9f607f into voidzero-dev:main Oct 21, 2026
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.

2 participants