I've set a cookie with domain of .example.com
. It is available for every first-level subdomain on my site, as it should be.
It is not, however, available on nth level subdomains, i.e. sub.subdomain.example.com
and too.many.subdomains.subdomain.example.com
don't see the cross-subdomain cookie while subdomain.example.com
does. Is there any fix for this?
Please everyone note that you can set a cookie from a subdomain on a domain. But you CAN'T set a cookie from a domain on a subdomain.
That is, if the domain name in your cookie's domain parameter doesn't start with a period, then it will not let subdomains read that cookie. If it does start with the period, then all subdomains will have full access to that cookie's value.
Cookies can be shared across domains, which means that a website from one domain can access the cookies from another domain.
All subdomains are on the same level. You won't have a subdomain within a subdomain like you would a subfolder within a subfolder.
The client seems not to follow the rules specified in the rfc. IE fails when there's an underscore in the domain name.
See https://www.rfc-editor.org/rfc/rfc6265#section-5.1.3
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With