mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #297] [MERGED] fix: preserve multiple Set-Cookie headers in response merging #455
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#455
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/297
Author: @NathanDrake2406
Created: 3/6/2026
Status: ✅ Merged
Merged: 3/6/2026
Merged by: @james-elicx
Base:
main← Head:fix/set-cookie-header-flattening📝 Commits (9)
3328ccefix: preserve multiple Set-Cookie headers in prod-server and worker entryb4edd1afix: address review feedback on Set-Cookie header preservation25ca620fix: apply Set-Cookie fix to example workers, remove redundant toLowerCase858cc01fix: add missing as string cast in deploy.ts middleware header collectiond7a65efmerge: resolve conflict with upstream/main1543aafrefactor: extract mergeHeaders to shared vinext/server/worker-utilsa415c61fix: array-accumulate Set-Cookie in config headers, fix JSDoc, add behavioral test389ea4dfix: indentation in deploy.ts template, array-accumulate Set-Cookie in example workers14f66c7fix: remove as any casts in prod-server.ts, add Vary handling to example workers📊 Changes
9 files changed (+335 additions, -79 deletions)
View changed files
➕
CLAUDE.md(+1 -0)📝
examples/pages-router-cloudflare/worker/index.ts(+32 -22)📝
examples/realworld-api-rest/worker/index.ts(+32 -22)📝
packages/vinext/package.json(+4 -0)📝
packages/vinext/src/deploy.ts(+50 -15)📝
packages/vinext/src/server/prod-server.ts(+47 -17)➕
packages/vinext/src/server/worker-utils.ts(+40 -0)📝
tests/deploy.test.ts(+30 -3)📝
tests/features.test.ts(+99 -0)📄 Description
Summary
prod-server.tsand the generated Cloudflare worker entry (deploy.ts)Record<string, string>pattern caused multiple Set-Cookie values to be overwritten (last wins) or corrupted by comma-joining (breaking cookies withExpiresdates)mergeResponseHeaders()helper usinggetSetCookie()(Node 20+) to preserve array-valued Set-Cookiedeploy.tsusing theHeadersAPIFixes #295
Test plan
mergeResponseHeaders+sendCompressedwith array headers)🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.