Purge Varnish When Using Cloudflare or other Proxy
Enabling the one-click Varnish add-on will auto-purge Varnish when the WP Rocket cache is cleared.
When you also use a proxy such as Cloudflare this can prevent the Varnish cache being purged.
The Varnish cache will be correctly purged even when using Cloudflare, as long as you have enabled our Cloudflare add-on. In this case, we will automatically set the Varnish host URL to
localhost for compatibility.
But if you are using a different proxy service, or are using Cloudflare without our add-on you will need to install the following helper plugin in order to create the compatibility and sync Varnish with your WP Rocket cache.
Heads up! Remember to replace
example.com with your domain name!
How to Check if Varnish was Cleared
You can check the
age header to see if Varnish was correctly purged.
To do that in Chrome, first open Developer Tools:
View → Developer → Developer Tools
Then click on the Network tab, and reload your website.
Look at the first request and check the value of the
age header. This is the age of the Varnish cache, in seconds. Immediately after purging, it will reset to