3

I've read that RFC 2109 requires a leading dot and RFC 6265 ignores the leading dot.

For a cookie shared across domain and sub domain in JavaScript the cookie can have the field ;domain=.domain or ;domain=domain

On the Mozilla documentation on cookies it says: "Contrary to earlier specifications, leading dots in domain names are ignored. If a domain is specified, subdomains are always included." https://developer.mozilla.org/en-US/docs/Web/API/Document/cookie

So what's the best practice? Include the leading dot notation or not? Perhaps including the dot allows for backward compatibility for browsers that uses the old standard.

uberdwang
  • 45
  • 7

0 Answers0