开发者

Why is dot needed to make a cookie available among subdomains?

开发者 https://www.devze.com 2022-12-20 15:48 出处:网络
We need to set the domain as .example.com to make it available for *.example.com, but why not 开发者_运维知识库example.com?example.com means \"exactly\" example.com ; and nothing more.

We need to set the domain as .example.com to make it available for *.example.com,

but why not 开发者_运维知识库example.com?


example.com means "exactly" example.com ; and nothing more.

If example.com was used to mean *.example.com, how would you set a cookie that's valid on example.com and not on subsite.example.com ?


The dot at the beginning says it'll be available for all subdomains. It's just... needed :)

If you don't use the initial dot, you'd be telling it to be only available for example.com (not even www.example.com).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号