As far as I know, one can set a cookie for example.com
and not .example.com
and then the cookie will only be visible on example.com
and not sub.example.com
. Is this true? I have set a cookie on a test domain I own, and it seems that cookies are not shared at static.mydomain.com
This page suggests otherwise:
Omitting www leaves you no choice but to write cookies to *.example.org, so for performance reasons it's best to use the www subdomain and write the cookies to that subdomain.