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.

Get Started
Who’s going to be learning?
Sign In
Welcome Back!
Thanks for reaching out!

You’ll hear from us shortly. In the meantime, why not check out what our customers have to say about ACG?

How many seats do you need?

  • $499 USD per seat per year
  • Billed Annually
  • Renews in 12 months

Ready to accelerate learning?

For over 25 licenses, a member of our sales team will walk you through a custom tailored solution for your business.