varnish cache
Share on facebook
Share on twitter
Share on linkedin

How to clear Varnish cache for a url

Anthony James
Anthony James

Varnish made some changes in how you clear the cache in Varnish 3. Hence the confusing title. However, it’s simple to clear the cache now, by using the “ban” command.

[:$] varnishadm -T ban.url /index.html

There are a few things you should be aware of. Varnish can run on different ports than 6089, so if you receive the following error:

Connection failed

It’s either because the IP address or the port that Varnish is listening on isn’t correct. A simple method to check this is to use the netstat command.

[:$] netstat -plnttcp 0 0* LISTEN 14142/varnishd

Here we see varnish is listening on the IP address and port 2222.So to clear/purge/ban the cache we just modify our command line command as follows

[:$] varnishadm -T ban.url /index.html

And you’re done!


Get more insights, news, and assorted awesomeness around all things cloud learning.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?