What does the dot prefix in the cookie domain mean?

The leading dot means that the cookie is valid for subdomains as well; nevertheless recent HTTP specifications (RFC 6265) changed this rule so modern browsers should not care about the leading dot. The dot may be needed by old browser implementing the deprecated RFC 2109.

RFC 6265 section 4.1.2.3

For example, if the value of the Domain attribute is “example.com”, the user agent will include the cookie in the Cookie header when making HTTP requests to example.com, www.example.com, and www.corp.example.com. (Note that a leading %x2E (“.”), if present, is ignored even though that character is not permitted, but a trailing %x2E (“.”), if present, will cause the user agent to ignore the attribute.)

Leave a Comment