2

I'm familiar with how to setup a cookie-less domain, however, I have an situation where I can't setup a subdomain to store static elements.

Can I set only my directories where assets are being stored to not require a cookie in the request?

1 Answer 1

2

This is not possible unfortunately. Cookies are attached at the domain level.

The way many sites, including the entire stack exchange network, deal with this is by having static content stored on a completely separate domain name, ie: something.stackexchange.com has all the static content stored on cdn.sstatic.net. As you can see it is not simply in a different subdomain which depending on the way your cookies are saved may still result in cookies being accessed from the static content domain, but is a completely separate domain name which uses the browsers native same origin security features for cookie security to make the domain a cookie free domain.

2
  • Chris, Can we setup subdomain like subdomain.domain.com and make subdomain cookieless and use it for static content Jul 29, 2018 at 5:48
  • Absolutely you can. The only thing you have to be careful of is setting any domain wide cookies which could possibly happen without realising it. Jul 29, 2018 at 21:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.