Repository navigation
Commit a9f607f
fix(routing): serve static files that a rewrite points to (#512)
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.
Co-authored-by: meganemura <290611+meganemura@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>1 parent 855bdf2 commit a9f607f
2 files changed
Lines changed: 9 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
414 | 414 | | |
415 | 415 | | |
416 | 416 | | |
417 | | - | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
418 | 420 | | |
419 | 421 | | |
420 | 422 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1394 | 1394 | | |
1395 | 1395 | | |
1396 | 1396 | | |
| 1397 | + | |
| 1398 | + | |
| 1399 | + | |
| 1400 | + | |
| 1401 | + | |
| 1402 | + | |
1397 | 1403 | | |
1398 | 1404 | | |
1399 | 1405 | | |
| |||
0 commit comments