[PR #758] [MERGED] fix: preserve multi-valued Set-Cookie headers in route handler ISR cache #822

Closed
opened 2026-05-06 13:10:18 +02:00 by BreizhHardware · 0 comments

📋 Pull Request Information

Original PR: https://github.com/cloudflare/vinext/pull/758
Author: @NathanDrake2406
Created: 4/3/2026
Status: Merged
Merged: 4/3/2026
Merged by: @james-elicx

Base: mainHead: fix/route-handler-cache-set-cookie


📝 Commits (1)

  • 95b28b2 fix: preserve multi-valued Set-Cookie headers in route handler ISR cache

📊 Changes

2 files changed (+60 additions, -3 deletions)

View changed files

📝 packages/vinext/src/server/app-route-handler-response.ts (+6 -3)
📝 tests/app-route-handler-response.test.ts (+54 -0)

📄 Description

Summary

  • buildAppRouteCacheValue() used headers.forEach() which overwrites same-key entries, dropping all but the last Set-Cookie header from cached responses
  • The restore path (buildRouteHandlerCachedResponse) already handles string[] correctly — only the store path was broken
  • Uses getSetCookie() to preserve all Set-Cookie headers as a string[], matching the pattern in worker-utils.ts and prod-server.ts

Test plan

  • Test: route handler with multiple Set-Cookie headers — all preserved after cache round-trip
  • Test: route handler with zero Set-Cookie headers — no regression
  • Existing app-router tests pass (275 tests)
  • Existing ISR cache tests pass (42 tests)

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/cloudflare/vinext/pull/758 **Author:** [@NathanDrake2406](https://github.com/NathanDrake2406) **Created:** 4/3/2026 **Status:** ✅ Merged **Merged:** 4/3/2026 **Merged by:** [@james-elicx](https://github.com/james-elicx) **Base:** `main` ← **Head:** `fix/route-handler-cache-set-cookie` --- ### 📝 Commits (1) - [`95b28b2`](https://github.com/cloudflare/vinext/commit/95b28b2ec55a5ca54978e0ae3ec755a639b264ff) fix: preserve multi-valued Set-Cookie headers in route handler ISR cache ### 📊 Changes **2 files changed** (+60 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `packages/vinext/src/server/app-route-handler-response.ts` (+6 -3) 📝 `tests/app-route-handler-response.test.ts` (+54 -0) </details> ### 📄 Description ## Summary - `buildAppRouteCacheValue()` used `headers.forEach()` which overwrites same-key entries, dropping all but the last `Set-Cookie` header from cached responses - The restore path (`buildRouteHandlerCachedResponse`) already handles `string[]` correctly — only the store path was broken - Uses `getSetCookie()` to preserve all Set-Cookie headers as a `string[]`, matching the pattern in `worker-utils.ts` and `prod-server.ts` ## Test plan - [x] Test: route handler with multiple Set-Cookie headers — all preserved after cache round-trip - [x] Test: route handler with zero Set-Cookie headers — no regression - [x] Existing app-router tests pass (275 tests) - [x] Existing ISR cache tests pass (42 tests) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
BreizhHardware 2026-05-06 13:10:18 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/vinext#822
No description provided.