Magento 2 Purge Varnish Cache

From Brian Nelson Ramblings
Jump to: navigation, search

Magento 2 Purge Varnish Cache

Magento 2 has the built in functionality to use Varnish Cache

This can be setup with:

bin/magento setup:config:set --http-cache-hosts=127.0.0.1:6081

Once this is set, the application should handle sending requests to varnish to purge the full page cache.

Purge Varnish Cache using Curl

Otherwise, you can send CURL requests as well like the following:

Using Curl to purge the varnish cache from the CLI is done with the following command

curl -H "X-Magento-Tags-Pattern: .*" -X PURGE 127.0.0.1:6081

Happy Varnish Speeds by default