3rd March 2015

How to remove, ban or purge content from Varnish 2 from the command line

John Ennew
Technical Director

If you have a piece of content in a varnish 2 cache it can be a little confusing how to get rid of it. The words, remove, refresh, ban and purge can be found on many guides however, their meaning and the way they work changed between version 2 and 3.

Assuming you are using Varnish 2 and you have the admin port listening on 6082 and the secret is installed in /etc/varnish/secret (which it usually is) then the command to remove a page is as follows. You must be on the server to run it.

sudo varnishadm -T 127.0.0.1:6082 -S /etc/varnish/secret purge.url "^/remove/this$"