Repository navigation
fix(routing): serve static files that a rewrite points to - #512
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A rewrite to a static file returns 404 when the app has no Pages, no fallback rules and no header rules. For example,
/t/:idrewritten to/app.htmlinpublic/.A rewrite dispatches its destination back into the generated app. In that setup the app has no not-found handler, so nothing asks
ASSETSfor/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.tsfails onmainand passes with this change.