Per the following article http://www.trellon.com/content/blog/boosted-varnish-high-performance-caching-made-easy#comment-8150 we're attempting to use Boost and Varnish on our Drupal 7 site.

As for why we want to use Boost and Varnish, it is to limit the impact of restarting/clearing the Varnish cache.

Anyway, when we install Boost and go to the status report page (/admin/reports/status), there is a message which states:

Boost will not function properly while Drupal core cache is enabled. Disable Boost or the core cache.

So we disable the core cache. When we do that the following HTTP header gets set:

Cache Control: no-cache, must-revalidate, post-check=0, pre-check=0

We re-enable the core cache and the headers read as:

Cache Control: public, max-age=900

As I understand, a cache control header of no-cache tells upstream proxies like varnish "you aren't allowed to cache this."

So essentially we have a dilemma: Boost requires core cache to be disabled, but disabling core cache makes the site un-cacheable by Varnish.
Leave core-cache enabled and Boost won't work.

How do we get them to play nice together? In other words, how can we disable the core cache to make Boost happy but not have the no-cache header set?

  • 1
    Its worth taking a look at Is it redundant to use the “boost” module if varnish is used? to make sure the configuration you're trying to get working is worthwhile for your circumstances.
    – mrP
    May 22, 2013 at 13:08
  • Just as an aside, you are not bound to use the default rules provided by Varnish. It may sometimes be simpler to change them than fix Drupal's headers. This may not be the best solution in your case, but you should at least consider it. Mar 11, 2014 at 9:53

1 Answer 1


drupal_add_http_header() in your own module will allow you to override Drupal's headers.

Not that it's needed - your headers will only be set to no-cache when you hit Drupal directly. Not for boosted statics. It is a good thing. You want to keep HTML from boost in varnish, after all, not the one generated directly.

I'm proposing to leave it be. Files from Boost cache will not generate these headers, so will be cacheable for varnish. You will only skip caching pages generated on direct Drupal hits. But you want to skip them. They may contain messages, for example. Boost does not cache when there are errors and messages, so leaving no-cache in Drupal will let you to use this behavior and make varnish respect it.

  • So are you proposing in settings.php we add drupal_add_http_header('Cache-Control', 'Public');? Is that safe to do? Or am I misunderstanding your proposed solution?
    – Brad
    May 21, 2013 at 19:11
  • If you feel you have to, yes, you may try to use settings.php. But I clarified my answer to more clearly show what I propose.
    – Mołot
    May 21, 2013 at 19:15
  • Here is a set of headers from my site:
    – Brad
    May 22, 2013 at 21:33
  • Accept-Ranges:bytes Accept-Ranges:bytes Age:0 Cache-Control:no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Connection:keep-alive Content-Length:100774 Content-Type:text/html; charset=utf-8 Date:Wed, 22 May 2013 21:30:27 GMT ETag:"189a6-4dd553c8fd084" Expires:Sun, 19 Nov 1978 05:00:00 GMT Server:Apache Set-Cookie:BNI__BARRACUDA_LB_COOKIE=000000000000000000000000cc6c630a00005000; Path=/; Max-age=120; HttpOnly Vary:Accept-Encoding Via:1.1 varnish X-Cached-By:Boost X-Origin-Server:WEB2 X-Varnish:1136681715 X-Varnish-Debug-TTL:-1.000
    – Brad
    May 22, 2013 at 21:34
  • Notice that despite X-Cached-By: Boost being set, Cache-Control still reads no-store. So what you're saying above that Boost cache will not generate these headers doesn't seem to be true (at least in my environment).
    – Brad
    May 22, 2013 at 21:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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