Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

setting cross-subdomain cookies accessible to a sub-subdomain?

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?

like image 602
ceejayoz Avatar asked May 18 '10 18:05

ceejayoz


People also ask

Can a subdomain set a cookie for another subdomain?

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.

Do subdomains have access to cookies?

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.

Can cookies be shared between domains?

Cookies can be shared across domains, which means that a website from one domain can access the cookies from another domain.

Can you have a subdomain of a subdomain?

All subdomains are on the same level. You won't have a subdomain within a subdomain like you would a subfolder within a subfolder.


1 Answers

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

like image 111
Robert Hensing Avatar answered Nov 09 '22 05:11

Robert Hensing