PageSpeed disable Varnish by default ! Get both working together
Yesterday a colleague (Dimitri) tested a tool on this blog. He informed me that Varnish was disabled and PageSpeed may be the cause as this is the last modification I’ve made on the server.
After verification he was totally right ! By default, PageSpeed disable cache by serving HTML files with:
Cache-Control: no-cache, max-age=0
After reading the PageSpeed documentation on that topic, it is clear: PageSpeed needs to know how to purge the cache as it rewrites a lot of elements and it has the control instead of the application. To get Varnish handled by PageSpeed, you need to add and adapt to your configuration those 3 lines for Nginx:
pagespeed DownstreamCachePurgeLocationPrefix http://127.0.0.1:80/; pagespeed DownstreamCachePurgeMethod PURGE; pagespeed DownstreamCacheRewrittenPercentageThreshold 95;
I updated my documentation with those options as well.