Skip to content

Purge The Varnish Fpc

The Stratus CLI is the best way to clear Varnish through shell on Stratus.

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

Curl still works if you are using SSH, the difference is 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

If the above is set you can perform a typical cache clear via the Magento 2 admin or Magento commands

php bin/magento cache:clean

You can also purge Varnish via the Flush Cache button under the Varnish->Info menu in the stratus panel.

Purging one URL

You have the option to purge just one url in Varnish cache under Varnish->Url Cache. Choose the correct base url, paste in the url and click "clear cache".

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, you can run this command via the shell 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