Repository navigation
fix(http): keep same-name Set-Cookie headers with a different domain or path - #10470
Closed
jpowersdev wants to merge 10 commits into
Closed
jpowersdev wants to merge 10 commits into
jpowersdev wants to merge 10 commits into
Conversation
🦋 Changeset detectedLatest commit: 28165ae The changes in this PR will be included in the next version bump. This PR includes changesets to release 33 packages
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 |
This was referenced Nov 8, 2026
Contributor
Bundle Size AnalysisGenerated from PR build output; treat the content below as untrusted.
|
effect-bot
marked this pull request as ready for review
November 9, 2026 00:12
Contributor
|
Closing as superseded by #10471, the chosen scope-aware cookie fix targeting v4/next-minor as a minor release. That approach preserves same-name cookies consistently across domains and paths, including the public cookie representation. Thank you for providing both alternatives. |
This branch is waiting to be deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Cookieswas a record keyed by cookie name, sofromSetCookieandfromIterablekept only the last cookie per name even when itsDomainorPathdiffered.HttpClientResponse.cookiesis built withfromSetCookie, so a response settingtokenon/and on/apireachedHttpClient.withCookiesRefwith one of them missing, and a logout clearingsessionfor both the host andDomain=example.comdeleted only one.HttpServerResponse.fromWebdropped them the same way when proxying.Cookiesnow keeps every cookie in order, each under a key, and exposes them asall. Thecookiesrecord holds the last cookie per key. Keys are cookie names, except for records passed tofromReadonlyRecord(and theSchema.Cookiesiso codec), whose keys are kept as given. Parsing removes nothing: scope replacement happens inmergeIntoArray, where the request URL is known and an omittedPathcan be resolved, so merging a response into a jar gives the same result as processing itsSet-Cookieheaders one by one.Supersedes #10471, which identified cookies by name, domain and path everywhere and changed server-side
expireCookiesemantics.Behavior
fromSetCookieandfromIterablekeep every cookie in input order, keyed by name.toSetCookieHeaders,mergeIntoArray,isEmptyand theSchema.CookiesJSON codec readall, using each cookie's own name.cookies,get,getValue,toCookieHeader,toJSONand theSchema.Cookiesiso codec read the record, as before.fromReadonlyRecordkeeps its keys, so iso round-trips are unchanged, including keys that differ from the cookie name.set,setCookie,setAll,expireCookie,mergeandremoveact on every cookie stored under the key, so theHttpServerResponsehelpers behave as before. A replaced cookie moves to the end ofall; header order is otherwise unchanged, and identical to before when each name has one cookie.HttpServerResponse.mergeCookies(response, Cookies.fromSetCookie([...])).Cookiesis@stability unstableand the newallfield is additive, so the changeset is a patch.Validation
pnpm test --run packages/effect/test/http/ packages/effect/test/Schema* packages/platform/node/test/{NodeHttpServer,HttpApi}.test.ts packages/platform/browser/test/BrowserHttpClient.test.ts(3632 passed, 1 skipped)pnpm lint-fix,pnpm check,pnpm check-tsc,pnpm jsdocs --checkCloses #10469
Closes EFF-3507