是否可以在子域之间共享Cookie [英] is it possible to share cookies between subdomains

查看:62
本文介绍了是否可以在子域之间共享Cookie的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在以下子域之间共享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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆