We have successfully configured varnish in our magento website, it's working great. But the problem is varnish is not purging when we clear the cache either via admin panel or ssh command. We restart varnish server every time. We have also configured CDN (It may be reason for this cache issue). We have tried to set http_cache_hosts using the command

bin/magento setup:config:set --http-cache-hosts=xx.xx.xxx.xxx:6081

Also tried with ports 8080,6082

In our .vcl file

acl purge {

Above configurations is not at all working. We are missing something to make it work. Can anyone help on this?


It is because of we missed to add our server ip address to the access list of varnish server. We can add our ip address also in the Access List field of Varnish configuration. If you use your own default.vcl in varnish server, it is enough to add magento server ip like below in default.vcl

acl purge {
    "xx.xx.xxx.xxx"; //Varnish server IP
    "yy.yy.yyy.yyy"; //Website server IP

Also make sure you have added varnish server ip in http_cache_hosts using below command

bin/magento setup:config:set --http-cache-hosts=xx.xx.xxx.xxx:80
  • Hiello sibhi how do we know varnish server ip and wbsite server ip? – Nagaraju Kasa Mar 7 at 8:45

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.