While investigating Mollom pages being cached in varnish I came across something I had not seen documented on any Drupal related varnish config to-date. It appears that varnish only pays attention to the max-age parameter in the Cache-Control header. Drupal however issues sends along "" which has no max-age parameter. This means that any page we are saying is not cache-able is being happily cache by varnish.
Places where I've found this hinted at:
- https://www.varnish-cache.org/docs/trunk/tutorial/increasing_your_hitrat...
- https://www.varnish-cache.org/trac/wiki/Introduction#Handlingtheweb-serv...
I've confirmed this by putting to trivial php scripts behind varnish, each running simply echo time(); and settings a cache-control header. On the first one I sent the default don't cache headers from drupal_page_header, and the other sent simply 'Cache-Control: max-age=0'. The first never updated, the second gave me a new time-stamp every second.
It seems like our options are either
- Push max-age=0 into our default headers. You might be able to argue this isn't something we can do for D7.
- Document this behavior on #1054886: Varnish Cache and do some education(reach out to blog posters like lullabot that have done posts about setting up varnsih and have then spread the word).
Thoughts?
Comments
Comment #1
neclimdulthe right queue this time.
Comment #2
neclimdul