Is there any way to set a cookie that is not readable on subdomains? In other words, have the cookie available on domain.com
, but not www.domain.com
or xyz.domain.com
.
//this is what i'm "intending"...
setcookie($name,$value,$expires,'/','domain.com');
//however, this is how it behaves:
setcookie($name,$value,$expires,'/','.domain.com');
The reasoning: I'm setting up a static CDN on a subdomain and don't want the user session cookies going back and forth for every image, css file, js file, etc.
...do I have to fall back to using www.domain.com
for my site? Are there any workarounds?