What is the cookie dot rule?

徘徊边缘 提交于 2019-12-21 05:28:25

问题


I am using Google Analytics and Google Website Optimizer together. On our development rig I suddenly realized that some cookies were set twice.

The GA cookies:

__utma
__umtb
__utmc
__utmz

where all set both by GWO and GA. I had only expected to see one set of these cookies. GWO set them with a dot in front of the domain name:

.dev.example.com

While GA set them as:

dev.example.com

I tried to google this and read something about it in RFC2109 HTTP State Management Mechanism

Searches for it here on SO, results in a number of answers referencing the "cookie dot rule", but I still don't really get it.

What exactly is that rule and which implications does it have?


回答1:


I take it you understand the basics of how cookies work, namely that with any HTTP request, the browser will send all "relevant" cookies that it has stored.

A cookie set for domain 'example.com' will only be relevant for requests to http://example.com, whereas a cookie for '.example.com' will be relevant to all its subdomains too



来源:https://stackoverflow.com/questions/638497/what-is-the-cookie-dot-rule

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!