0

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

Dennis Williamson
  • 60,515
  • 14
  • 113
  • 148
iTech
  • 355
  • 4
  • 15

2 Answers2

1

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

iTech
  • 355
  • 4
  • 15
0

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
Dan Andreatta
  • 5,384
  • 2
  • 23
  • 14
  • 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 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 06:10
  • I supposed there was a way to do it in Drupal, but I don't do Drupal. – Dan Andreatta Mar 24 '10 at 10:47