Skip to content

fix: preserve multiple Set-Cookie headers on 304 responses#15902

Open
MathiasWP wants to merge 2 commits into
sveltejs:mainfrom
MathiasWP:find-fixable-github-issues
Open

fix: preserve multiple Set-Cookie headers on 304 responses#15902
MathiasWP wants to merge 2 commits into
sveltejs:mainfrom
MathiasWP:find-fixable-github-issues

Conversation

@MathiasWP
Copy link
Copy Markdown
Contributor

Summary

Fixes #15527.

Headers.get('set-cookie') collapses multiple values into a single comma-joined string that browsers cannot parse, so the 304 path was silently dropping all cookies after the first (most visible on non-Node adapters, where splitCookiesString recovery doesn't exist).

Iterates Headers.getSetCookie() and appends each cookie individually, matching the pattern already used by add_cookies_to_headers in cookie.js.

Test plan

  • New Playwright test etag forwards multiple cookies exercises the 304 path with three cookies
  • Existing etag forwards cookies test still passes
  • pnpm -F @sveltejs/kit test:unit passes

`Headers.get('set-cookie')` collapses multiple values into a single
comma-joined string that browsers cannot parse. Iterate
`Headers.getSetCookie()` and append each cookie individually so all
cookies survive an `If-None-Match` revalidation.

Fixes sveltejs#15527

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 23, 2026

🦋 Changeset detected

Latest commit: 0d56264

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@sveltejs/kit Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Multiple Set-Cookie headers collapsed into single malformed header in 304 responses

1 participant