Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to achieve cookie free image serving as discussed here :

I have created a new sub-domain "" serving only images, javscript and css (file serving restrictions made via filesmatch.conf file) , pls. tell how to make it serve cookie free images.


share|improve this question

For Drupal (and probably Wordpress) this can be easily fixed by setting up $cookie_domain = '' value in settings.php.

share|improve this answer

You should make the cookie specific for the "dynamic" domain, e.g. instead of

Set-Cookie:  name=newvalue; expires=date; path=/;

do this

Set-Cookie:  name=newvalue; expires=date; path=/;

then the client will not send the cookie to retrieve the static content.

It seems this can be done at the Apache level with mod_headers. What you probably need is to add a line to your "dynamic" domain like (not tested):

Header edit Set-Cookie
share|improve this answer
I am using drupal and it sets the cookies, I don't want to change drupal config and simply strip cookies from my static subdomain. – iTech Mar 23 '10 at 15:04
Good to know. I have edited my answer. – Dan Andreatta Mar 23 '10 at 15:17
Thanks Dan, this seems to be the solution I am looking for - can you pls. tell the exact syntax to put into my apache "filesmatch.conf" file for "" subdomain to get this working. Thanks – iTech Mar 23 '10 at 15:37
That configuration goes for the domain, instructing the client not to send the cookie to It can go anywhere in the configuration, probably you want it in the main <VirtualHost> section – Dan Andreatta Mar 23 '10 at 16:03
Thanks a lot Dan for posting Apache solution but I found a better solution posted as answer to this query. – iTech Mar 24 '10 at 6:10

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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