mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #291] [MERGED] Use append for multi-value headers in config header application #450
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#450
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/291
Author: @southpolesteve
Created: 3/6/2026
Status: ✅ Merged
Merged: 3/6/2026
Merged by: @southpolesteve
Base:
main← Head:fix/config-headers-append-multi-value📝 Commits (2)
0fd8de4Apply same append logic for multi-value headers in index.ts and deploy.ts43fac26Add append logic for multi-value config headers in prod-server.ts and app-dev-server.ts📊 Changes
6 files changed (+79 additions, -4 deletions)
View changed files
📝
packages/vinext/src/deploy.ts(+11 -1)📝
packages/vinext/src/index.ts(+25 -1)📝
packages/vinext/src/server/app-dev-server.ts(+10 -1)📝
packages/vinext/src/server/prod-server.ts(+18 -1)📝
tests/fixtures/pages-basic/next.config.mjs(+5 -0)📝
tests/pages-router.test.ts(+10 -0)📄 Description
Summary
next.config.jswere applied usingset(), which replaces any existing header with the same key. For multi-value headers likeVaryandSet-Cookie, this destroys previously set values. For example, a config header settingVary: Accept-Languagewould replace the existingVary: RSC, Acceptheader, breaking CDN caching behavior.append()forVaryandSet-Cookieheaders so values accumulate correctly. All other headers continue to useset()(override is the correct behavior for single-value headers).Changes
packages/vinext/src/server/app-dev-server.ts: Config header application in handler() wrapper usesappend()for Vary and Set-Cookie,set()for all others.packages/vinext/src/server/prod-server.ts: Config header merging into middlewareHeaders object concatenates Vary and Set-Cookie values instead of overwriting.tests/fixtures/pages-basic/next.config.mjs: Added a Vary config header rule on/ssr.tests/pages-router.test.ts: New test verifying Vary config header appears in the response.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.