Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

http://code.google.com/speed/page-speed/docs/request.html#ServeFromCookielessDomain

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

Thanks

share|improve this question

2 Answers 2

For Drupal (and probably Wordpress) this can be easily fixed by setting up $cookie_domain = 'www.example.com' 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=/; domain=.example.org

do this

Set-Cookie:  name=newvalue; expires=date; path=/; domain=www.example.org

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 domain=.example.org domain=www.example.org
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 "static.example.com" subdomain to get this working. Thanks –  iTech Mar 23 '10 at 15:37
    
That configuration goes for the www.example.com domain, instructing the client not to send the cookie to static.example.com. 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

 
discard

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.