mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[GH-ISSUE #988] Validate RSC request headers to prevent CDN cache poisoning #216
Labels
No labels
enhancement
enhancement
good first issue
help wanted
nextjs-tracking
nextjs-tracking
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/vinext#216
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @github-actions[bot] on GitHub (Apr 30, 2026).
Original GitHub issue: https://github.com/cloudflare/vinext/issues/988
Upstream change
Next.js enabled
experimental.validateRSCRequestHeadersby default in vercel/next.js#93367 (commit 4ba05cc).Why this matters for vinext
App Router responses come in three flavors that share the same URL but differ by request headers:
RSCheader)RSC: 1)RSC: 1,Next-Router-Prefetch: 1)A CDN that does not honor
Vary: RSC, Next-Router-Prefetch, ...can cache one variant and serve it for a request that asked for a different variant. For Cloudflare deployments behind a CDN (Cloudflare cache, Workers' built-in cache, or any upstream CDN) this is a real cache-poisoning risk.validateRSCRequestHeadersis Next.js's defense-in-depth: when a request arrives with theRSCheader but other expected RSC headers are missing or inconsistent (a fingerprint of cache-poisoned content), the server treats the request as a regular HTML navigation instead of trusting the cached RSC response.Action
server/app-*.ts,entries/app-rsc-entry.ts) distinguishes HTML / RSC / prefetch-RSC requestsVaryheaders are set correctly on every App Router response so well-behaved CDNs distinguish the variantsvalidateRSCRequestHeadersvalidation: when an incoming RSC-shaped request fails the integrity check, fall back to the HTML render path.nextjs-ref/packages/next/src/, search forvalidateRSCRequestHeaders)References
github.com/vercel/next.js@4ba05cc300