Skip to content

Purge the Varnish FPC

The Stratus CLI is the best way to clear Varnish through shell access:

/usr/share/stratus/cli cache.varnish.clear

Curl also works if you are using SSH. The Varnish hostname is varnish:

curl -X 'PURGE' -H'X-Magento-Tags-Pattern: .*' varnish

Magento 2 users should set their http-cache-host accordingly:

php bin/magento setup:config:set --http-cache-hosts=varnish

Once the above is set, a typical cache clear via the Magento 2 admin or Magento commands is possible:

php bin/magento cache:clean

Varnish can also be purged via the Flush Cache button in the Varnish > Info Stratus control panel.

Purging One URL

One URL can be purged using the Varnish > Url Cache Stratus control panel.

Static Files Not Refreshing

Magento 2 currently has a bug in its VCL where static files will not refresh despite the purge listed above. See https://github.com/magento/magento2/issues/8113

As a workaround, run this command via shell access on your MageMojo server:

varnishadm "ban req.url ~ "/" "

Further reading

For more understanding about Magento 2 and Varnish, please read the official dev docs at http://devdocs.magento.com/guides/v2.0/config-guide/varnish/use-varnish-cache.html