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?
Webmasters Stack Exchange is a question and answer site for webmasters. It only takes a minute to sign up.
Sign up to join this communityThis 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.