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?


2 Answers 2


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:


Full configuration Guide:


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 Mar 11, 2019 at 12:30
  • I have followed all the steps but i would like to know whether varnish cache working or not how to do? Mar 19, 2019 at 3:23

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 ''

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.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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