是否可以在域和子域名之间共享Cookie [英] Is it possible to share a cookie between a domain and a subsubdomain
本文介绍了是否可以在域和子域名之间共享Cookie的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试在www.example.com和admin.other.example.com之间分享Cookie。b我可以将其与other.example.com一起使用,但没有办法访问子子域
I'm trying to share a cookie between www.example.com and admin.other.example.com I've being able to make it work with other.example.com, but there's no way to access the sub-sub-domain
编辑:我通过将Cookie域定义为.example.com来处理子域(请注意第一个点)
I handle subdomains by defining the cookie domain as .example.com (note the first dot)
推荐答案
您只能在域与其自己的子域之间共享Cookie。
例如:
You can only share cookies between a domain and its own subdomains. For example:
- 为域
example.com定义的Cookie
可以通过www.example.com
和foo.bar.example.com
$ b访问$ b - 为
www.example.com
定义的Cookie可以通过foo.www.example.com
,但不是bar.example.com
- a cookie defined for the domain
example.com
can be accessed bywww.example.com
andfoo.bar.example.com
- a cookie defined for the domain
www.example.com
can be accessed byfoo.www.example.com
but not bybar.example.com
这篇关于是否可以在域和子域名之间共享Cookie的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文