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.

📥  Download (.zip):  WP Rocket | Varnish IP with Proxy
Developers: You can find the code for this plugin on GitHub.

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 0:

How To Check The Varnish Header

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.