You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A pure/without-side-effect form of CookieStore.
Then, userland request libraries can accept a CookieStore instance as an option.
I have also considered...
Polyfilling the CookieStore instance.
got (userland request library) provides server-side cookie support with tough-cookie, which exposes a CookieJar that manages cookies, where an instance is passed straight to got.
I had implemented this a few years ago (#1441) but I gave up. The API is terrible and it conceptually does not work in a server environment. As mentioned, there's no global cookieStore and there's no origin handling - this is a glorified (or rather shittified) re-implementation of the existing cookie parsing undici already has.
If we implemented this it would neither function nor behave as other implementations. It wouldn't be hard to implement, but why should we implement it?
When server request libraries implement cookie support, they have to just pick a conventional userland cookie library and only support that.
I would like if we could centralize this functionality in Node itself, and across other server-side JavaScript platforms, so implementing CookieStore seems like a logical way to do this.
I'm curious, what are the use cases we can enable for servers having support for cookies; I imagine doing mimic of browser behaviour (e.g. web scrapper), but I'm having troubles to see more use cases beyond that.
I would like if we could centralize this functionality in Node itself, and across other server-side JavaScript platforms, so implementing CookieStore seems like a logical way to do this.
There's a reason other platforms have not implement the spec. Its only saving grace is that document.cookie in the browser is far worse.
Implementing CookieStore (a bastardized version of it) is only half the issue because we would still have to implement our own CookieStore manager that no other platform implements. So we wouldn't have a good implementation of CookieStore and we wouldn't match other platforms. Doesn't tough-cookie work on other serverside environments already?
Activity
CookieStorenode#59799 as a duplicate of this issueKhafraDev commentedon Sep 7, 2025
I had implemented this a few years ago (#1441) but I gave up. The API is terrible and it conceptually does not work in a server environment. As mentioned, there's no global cookieStore and there's no origin handling - this is a glorified (or rather shittified) re-implementation of the existing cookie parsing undici already has.
If we implemented this it would neither function nor behave as other implementations. It wouldn't be hard to implement, but why should we implement it?
Richienb commentedon Sep 8, 2025
When server request libraries implement cookie support, they have to just pick a conventional userland cookie library and only support that.
I would like if we could centralize this functionality in Node itself, and across other server-side JavaScript platforms, so implementing
CookieStoreseems like a logical way to do this.metcoder95 commentedon Sep 8, 2025
I'm curious, what are the use cases we can enable for servers having support for cookies; I imagine doing mimic of browser behaviour (e.g. web scrapper), but I'm having troubles to see more use cases beyond that.
Richienb commentedon Sep 8, 2025
Yes, browser behaviour seems to be the main use case, when surveying over https://github.com/salesforce/tough-cookie/network/dependents
KhafraDev commentedon Sep 8, 2025
There's a reason other platforms have not implement the spec. Its only saving grace is that document.cookie in the browser is far worse.
Implementing CookieStore (a bastardized version of it) is only half the issue because we would still have to implement our own CookieStore manager that no other platform implements. So we wouldn't have a good implementation of CookieStore and we wouldn't match other platforms. Doesn't tough-cookie work on other serverside environments already?
Richienb commentedon Sep 8, 2025
Ok, looks like tackling this issue should be more upstream so that we can hope to get the benefit of everyone using the same thing.
Uzlopak commentedon Sep 9, 2025
to be honest, the current cookie parsing logic is anyway crap because we "copied" it from deno.
KhafraDev commentedon Sep 18, 2025
I don't see a way to move forward on this re: previous comments.