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:

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

  1. Push max-age=0 into our default headers. You might be able to argue this isn't something we can do for D7.
  2. 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

neclimdul’s picture

Project: Configuration management initiative » Drupal core
Version: » 8.x-dev
Component: Code » cache system

the right queue this time.

neclimdul’s picture

Status: Active » Closed (fixed)