What's new
DevAnswe.rs Forums

Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts.

How can I determine if Varnish cache is functioning properly on my WordPress site?

josephp

New member
My WordPress website is hosted on a Cloudways managed server, with Varnish cache enabled server-side. Additionally, I have installed the WP Fastest Cache plugin on my site and provided the IP address to connect with Varnish Cache. My site is also connected to Cloudflare CDN. Given this setup, how can I confirm that Varnish cache is appropriately connected and functioning on my WordPress site?

I tried examining the headers of files on the site, but it seems they only display Cloudflare information (such as HIT status and cache expiry time). I am unable to find any Varnish-related information. Am I missing something, or should I disconnect my site from Cloudflare CDN to check this?
 

Zombo

Moderator
Check the HTTP response headers.
  1. Open your browser's developer tools (usually by pressing F12 or right-clicking and selecting "Inspect").
  2. Go to the "Network" tab and reload your website.
  3. Click on the main document request (usually the first request with the same domain name as your website).
  4. Inspect the "Headers" section in the right pane.
If Varnish is working correctly, you should see an "X-Varnish" header with a unique ID, and potentially an "X-Cache" header with a value like "HIT" or "MISS." Since yourusing Cloudflare CDN, the Varnish headers might be obscured by Cloudflare's headers. To see Varnish headers, you can temporarily pause Cloudflare or bypass the cache.

To pause Cloudflare:
  1. Log in to your Cloudflare account.
  2. Select your domain.
  3. Go to the "Overview" tab.
  4. In the "Advanced Actions" section, click "Pause Cloudflare on Site."
Once Cloudflare is paused, you can check the HTTP response headers again to see if Varnish headers are present. Remember to un-pause CloudFlare once you're done verifying Varnish cache. If you still don't see Varnish headers, there might be a configuration issue. In that case, double-check your Varnish and WP Fastest Cache settings or consult Cloudways support...
 
Top