Closed EvHaus closed 1 month ago
I'm running into this same issue, reverting back to 0.6.0
for now
We're running into a similar issue where our leading .
is needed to support subdomains.
(Note that a leading %x2E ("."), if present, is ignored even though that character is not permitted, but a trailing %x2E ("."), if present, will cause the user agent to ignore the attribute.)
@EvHaus Is that the language you are reading that the leading dot should be allowed, since I don't see your specific phrasing?
And then 5.2.3:
Let cookie-domain be the attribute-value without the leading %x2E (".") character.
So it looks like the dot isn't required and isn't permitted in the spec for Set-Cookie
, but I'm happy to be a bit looser with the spec here and allow the leading dot.
Is that the language you are reading that the leading dot should be allowed, since I don't see your specific phrasing?
Correct.
So it looks like the dot isn't required and isn't permitted in the spec for Set-Cookie
That's surprising to me. How would a cookie target all subdomains with it?
How would a cookie target all subdomains with it?
If you specify the domain, they automatically target all subdomains. It surprised me too. It's part of the domain-match
part of the spec.
Domain match: 5.1.3. Building the cookie header is specified here: 5.4. TL;DR: no domain = host-only, domain = send for this domain and any subdomain.
The leading dot behavior is from the earlier spec: https://datatracker.ietf.org/doc/html/rfc2109.
Released a fix in https://github.com/jshttp/cookie/releases/tag/v0.7.1.
After upgrading from
0.6.0
to0.7.0
this code no longer works:This now throws
option domain is invalid
.According RFC6265 Section 4.1.2.3 a leading
.
(dot) should be allowed for targeting subdomains. Am I doing something wrong, or is this a possible 0.7.0 bug?