cloudflare / cloudflare/vinext
App Router: preserve trailing slashes during static-export MPA fallback
- Dominant language
- TypeScript
- Stars
- 8.8k
- Forks
- 406
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 120
Description
## Next.js Change
**Commit:** [`14a69ef`](https://github.com/vercel/next.js/commit/14a69ef78b94c9bdb68b2f1d5d1a55599ff8022c)
**PR:** [#97613](https://github.com/vercel/next.js/pull/97613)
## What changed
When an App Router client navigation in a static export receives Flight data with a foreign build ID, Next.js falls back to a full-page navigation. For a route requested with a trailing slash, the generated Flight marker is `index.txt`; stripping that marker must retain the slash before applying the configured trailing-slash normalization.
Previously, Next.js removed one character too many from `/target/index.txt`, causing the MPA fallback to visit `/target` rather than the canonical `/target/`, and then incur a redirect when `trailingSlash: true` is configured.
## Impact on vinext
vinext's App Router client must preserve the requested trailing slash when it derives the full-page fallback URL from static-export Flight data. Otherwise apps with `output: 'export'` and `trailingSlash: true` can navigate through an avoidable redirect whenever client and static-export build IDs are skewed.
## Acceptance criteria
- [ ] For `output: 'export'` and `trailingSlash: true`, a client navigation to `/target/` that falls back because of a foreign Flight build ID performs its document request at `/target/`.
- [ ] The fallback must not first request `/target` or add a redirect hop.
- [ ] Preserve the existing behavior for slashless routes and configured trailing-slash normalization.
- [ ] Add browser regression coverage using a static export server that replaces a route's Flight build ID with a foreign one.
## Related
- vercel/next.js#97608 — upstream bug report
Contributor guide
Research direction
Start at the App Router client fallback handling for static-export Flight data and inspect the browser regression setup that uses a static export server. Reproduce a foreign Flight build ID for a request to `/target/` with `trailingSlash: true`, then verify the document request stays at `/target/` without a redirect while slashless routes retain their existing normalization.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- nextjs, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 72/100