3

The current website running on Magento 2.2.4 CE and we have enabled varnish cache.

How do we know if varnish cache is working or not in Magento 2?

Please advise?

1

According to Magento, you can perform some final verifications to make sure Varnish is working.
One of which is Verifying HTTP response headers

First, make sure you are using Magento’s developer mode; otherwise, you won’t see the headers.

For example,

curl -I -v --location-trusted 'http://192.0.2.55/magento2'

Important headers:

X-Magento-Cache-Control: max-age=86400, public, s-maxage=86400
Age: 0
X-Magento-Cache-Debug: MISS

This value is also acceptable: X-Magento-Cache-Debug: HIT.

If you get a MISS value in that header, Varnish is (for some reason) unable or unwilling to cache your content.

1

You need to follow Magento 2 devdocs as they told step to step setting and configuration of varnish cache.
If you have already installed varnish cache on your server then you need to configure Port in admin of Developer section then you will require to final verification that it's working or not as per below guideline of Devdoc Magento 2:

https://devdocs.magento.com/guides/v2.3/config-guide/varnish/config-varnish-final.html

Full configuration Guide:

https://devdocs.magento.com/guides/v2.3/config-guide/varnish/config-varnish.html

As per Magento Docs,you can also check that Varnish cache working or not as per below steps:

Make sure the /var/page_cache directory is empty:

Step1: Log in to your Magento server, or switch to, the Magento file system owner.

Step2: Clear page_cache manually with below command

  rm -rf <your Magento install dir>/var/page_cache/*

Step3: Access one or more cacheable Magento pages by navigate some page randomly.

Step4: Check the var/page_cache/ directory.

If the directory is empty, congratulations! You successfully configured Varnish and Magento to work together! If you cleared the var/page_cache/ directory, restart Varnish.

  • thanks @akgola let me check and get back – NIPPU Mar 11 at 12:30
  • I have followed all the steps but i would like to know whether varnish cache working or not how to do? – NIPPU Mar 19 at 3:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.