mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #488] fix: replay render-time response headers for cached App Router responses #610
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#610
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?
📋 Pull Request Information
Original PR: https://github.com/cloudflare/vinext/pull/488
Author: @JaredStowell
Created: 3/12/2026
Status: 🔄 Open
Base:
main← Head:jstowell/render-response-headers-cache-parity📝 Commits (10+)
86aedcaAdd tests for render headers7eff581Review CI failures and plan fixes18f9483Review and fix CI failuresd33fdb2Fix ISR generateRscEntry testsa2cddaeFix cached header replay parity36f6ce4Fix cached header replay duplicates17c5808Fix cached header replay03ac94dFix render response header parity regressions09b70a5Restore app router parity after rebaseca4e4c6Fix remaining CI failures📊 Changes
41 files changed (+2976 additions, -825 deletions)
View changed files
📝
benchmarks/vinext-rolldown/tsconfig.json(+2 -1)📝
benchmarks/vinext/tsconfig.json(+2 -1)📝
packages/vinext/src/entries/app-rsc-entry.ts(+203 -103)📝
packages/vinext/src/index.ts(+6 -0)📝
packages/vinext/src/server/app-page-cache.ts(+101 -13)📝
packages/vinext/src/server/app-page-render.ts(+32 -3)📝
packages/vinext/src/server/app-page-response.ts(+97 -29)📝
packages/vinext/src/server/app-page-stream.ts(+0 -1)📝
packages/vinext/src/server/app-route-handler-execution.ts(+24 -12)📝
packages/vinext/src/server/app-route-handler-response.ts(+112 -25)📝
packages/vinext/src/server/isr-cache.ts(+2 -1)📝
packages/vinext/src/shims/headers.ts(+196 -19)📝
packages/vinext/src/shims/unified-request-context.ts(+15 -7)📝
tests/__snapshots__/entry-templates.test.ts.snap(+1179 -569)📝
tests/app-page-boundary-render.test.ts(+2 -2)📝
tests/app-page-cache.test.ts(+68 -2)📝
tests/app-page-render.test.ts(+7 -0)📝
tests/app-page-response.test.ts(+20 -4)📝
tests/app-page-stream.test.ts(+2 -2)📝
tests/app-route-handler-execution.test.ts(+24 -25)...and 21 more files
📄 Description
Bring cached App Router response-header behavior closer to Next.js by preserving and replaying render-time response headers losslessly.
This fixes parity for headers that are mutated during render rather than after the final
Responseis created, including:VarySet-CookieWWW-Authenticate/Proxy-AuthenticateWhat changed
Headers, so repeated non-cookie headers are not flattened before cachingset-cookie: append and preserve ordervary: append/merge, never overwritewww-authenticate/proxy-authenticate: append repeated valuesHITandSTALEresponsesMISSresponsesTests
Added and updated coverage for:
MISS/HIT/STALE/ post-regenerationHITMISS/HITVaryreplay across cached responsesWWW-Authenticatereplay/merge behaviorSet-CookiereplayVary, and cookie merge behavior on cached responsesnotFound()special-response handlingcookies()anddraftMode()serialization into render response headersValidation
Ran:
pnpm test tests/shims.test.ts tests/isr-cache.test.ts tests/app-router.test.ts tests/entry-templates.test.ts -upnpm run fmtpnpm run typecheckNotes
This does not special-case cookies. The cached artifact is a general render-time response-header payload with lossless multi-value handling for repeated headers.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.