Is it possible to share cookies between the following subdomains??
sharepoint.server.com AND data.server.com
The cookie's value can be read or written from all subdomains.
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.
Cookies are small pieces of data that are stored on your computer when you visit a website. Cookies are used to remember your preferences and to track your behavior on the website. You can share cookies across domains by setting the domain attribute of the cookie.
If a cookie is scoped to a parent domain, then that cookie will be accessible by the parent domain and also by any other subdomains of the parent domain.
You can specify the cookie's domain in your header
Set-Cookie: name=value; domain=.mydomain.com
the .
in front of the URL makes the cookie available throughout any subdomain.
In RFC 2109, a domain without a leading dot meant that it could not be used on subdomains, and only a leading dot (
.mydomain.com
) would allow it to be used across subdomains.
source and more details
According to MDN, leading dots are no longer required to include subdomains. Subdomains are now included within the domain declaration.
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