Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the cookie dot rule?

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?

like image 810
Nicolai Avatar asked Mar 12 '09 12:03

Nicolai


People also ask

Are cookies automatically sent to server?

No. Not every request sends the cookies. It depends on the cookie configuration and client-server connection. For example, if your cookie's secure option is set to true then it must be transmitted over a secure HTTPS connection.


1 Answers

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

like image 63
Gareth Avatar answered Oct 02 '22 11:10

Gareth