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 127.0.0.1:6089 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 192.168.1.1:2222 0.0.0.0:* LISTEN 14142/varnishd

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

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

And you’re done!

Recommended

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

Get Started

Who’s going to be learning?

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.


$2,495.00

Checkout