eZ Publish 5 being built on top of Symfony 2, it uses standard HTTP cache headers. By default the Symfony 2 reverse proxy, written in PHP, is used to handle cache, but it can be easily replaced with any other reverse proxy like Varnish.
Use of Varnish is a requirement for use in Clustering setup, for overview of clustering feature see Clustering.
Version compatibility: 5.4 / 2014.11 AND HIGHER
To use Varnish with 5.2 or 5.3, please see Using Varnish with eZ Publish 5.2-5.3
Prerequisites
- A working Varnish 3 or Varnish 4 setup.
Recommended VCL base files
For Varnish to work properly with eZ, you'll need to use one of the provided files as a basis:
Note: Http cache management is done with the help of FOSHttpCacheBundle. One may need to tweak their VCL further on according to FOSHttpCache documentation in order to use features supported by it.
6 Comments
Carlos Revillo
Shouldn't we maitain following if from the varnish default.vcl in our ezpublish.vcl?
https://www.varnish-cache.org/trac/browser/bin/varnishd/default.vcl?rev=3.0#L59
If removed, i have problems with post requests, example, sending data in a contact form...
Carlos Revillo
Out of scope of ez5 itself, but if you need to install Varnish Curl Vmod, there is a good tutorial here (for Debian)
http://lassekarstensen.wordpress.com/2013/07/29/building-a-varnish-vmod-on-debian/
It uses another module but the process is the same for all modules.
Jérôme Vieilledent
Carlos: Thanks. I just added this link to the page as an example for Debian.
Peter Keung
This doc page should mention that the Apache environment variable TRUSTED_PROXIES should be set if your Varnish install(s) sits on a different server. Otherwise you will get a nasty surprise when ESI breaks.
André Rømcke
Peter: Added, thanks!
Mauricio Sánchez
It is possible to use Basic HTTP Authentication in the cache invalidation request?
i. e: