是否可以在子域之间共享Cookie [英] is it possible to share cookies between subdomains
问题描述
是否可以在以下子域之间共享Cookie?
Is it possible to share cookies between the following subdomains??
sharepoint.server.com AND data.server.com
推荐答案
您可以在标题中指定cookie的域
You can specify the cookie's domain in your header
Set-Cookie:名称=值;domain = .mydomain.com
.
使cookie可以在任何子域中使用.
the .
in front of the URL makes the cookie available throughout any subdomain.
在 RFC 2109 中,没有前导点的域表示该域名无法使用在子域上,只有前导点(
.mydomain.com
)允许跨子域使用它.
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.
根据 MDN ,不再需要前导点包含子域.现在,子域已包含在域声明中.
According to MDN, leading dots are no longer required to include subdomains. Subdomains are now included within the domain declaration.
这篇关于是否可以在子域之间共享Cookie的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!