When testing a View that was built with Views PHP we were unable to use Varnish to cache some views with the Global: PHP field enabled. It seems that the Views cache is being called and overwriting Drupal's Cache-Control headers such that we are seeing headers with:

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

rather than:

Cache-Control: public, max-age=21600

Which is what I get for other pages in the site and also on this same Views page with the PHP field disabled.

I can't see why the Cache-Control would need to be changed by this view. Any thoughts would be appreciated.

Comments

nerdcore’s picture

I've spent a number of frustrating hours trying to track down why Drupal was delivering two similarly structured pages with two different Cache-Control headers.

https://drupal.org/node/1196916#comment-6673706

If there is in fact some Views PHP setting which is clobbering the would-be Cache-Control header which allows caching with one that doesn't, this definitely needs to be addressed.

mgifford’s picture

With this module it seems to work:
http://drupal.org/project/views_content_cache

It shouldn't be necessary though to enable yet another module so that the cache is handled properly.