cloudflare / cloudflare/vinext
Dev server: prevent stale document restores with Cache-Control no-store
- Dominant language
- TypeScript
- Stars
- 8.8k
- Forks
- 406
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 120
Description
## Next.js Change
**Commit:** [`2839982`](https://github.com/vercel/next.js/commit/2839982a037412b99c05fbe8579a82b16ca8d2d9)
**PR:** [#97505](https://github.com/vercel/next.js/pull/97505)
## What changed
Next.js development documents and RSC/data responses now send `Cache-Control: no-store`, rather than `no-cache, must-revalidate`. Browsers can restore a stored document during a back/forward navigation without revalidating it, which otherwise displays output from before the latest edit.
Development static assets remain `no-cache, must-revalidate`: they have ETags, so the browser can make a conditional request, receive `304`, and reuse the cached body rather than re-download chunks on every page load.
## Impact on vinext
vinext must match this response split in development for both App and Pages Router paths. HTML documents and RSC/data responses must never be stored, while static assets should remain revalidatable. This prevents a history navigation from restoring stale pre-HMR document output without unnecessarily disabling asset caching.
## Acceptance criteria
- [ ] App Router development HTML and RSC responses return `Cache-Control: no-store`.
- [ ] Pages Router development HTML and data responses return `Cache-Control: no-store`.
- [ ] Development static assets retain `Cache-Control: no-cache, must-revalidate` and continue to return `304` for unchanged conditional requests.
- [ ] Add regression coverage that edits a page after navigating away, then verifies browser back navigation displays the edited result.
- [ ] Cover both router families and verify the static-asset behavior independently.
## Related
- vercel/next.js#96503 — upstream stale-development-page report
Contributor guide
Research direction
Start at the development response handling for the App Router and Pages Router paths, then trace how HTML, RSC/data responses, and static assets set Cache-Control. Add regression coverage for editing a page, navigating away, and using browser back navigation, covering both routers; verify unchanged conditional asset requests still return 304.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- nextjs, typescript
- Domain
- backend, testing, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100