How to Purge/Clear Varnish Cache for a Single URL?

varnish clear cache url

Varnish is a reverse web proxy accelerator that caches the HTTP contents. It can speed up requests by a factor of 500-1000 times. By caching and saving CPU time and database requests for content, varnish is able to server hundreds of consecutive requests per second.

What is the need for a Varnish cache?

The need for varnish cache is to boost up the loading speed of your website and reduce the load on servers.

It is also possible that when a website has new content, showing you the cached results would be irritating and annoying.

What is Varnish Cache?

It is a web application accelerator that is also commonly known as caching HTTP reverse proxy.

It really works fast and boosts up the speed of loading a website, which all depends on server architecture.

Purging can only be possible when you select an object and discard it.

If you like our content, we are sure you will love our plans. WPoven offers FREE Business emails, WP support & Dev support, FREE SSD, SSL, FREE Premium themes & Plugins. You can host unlimited websites & get Dedicated servers with plan starting just $16.61.

Plans & Features


In order to purge or clear Varnish cache, you can simply restart Varnish. This will clear the varnish cache.

/etc/varnish restart

or if you are using 'services' on your server, you can run the following on the command line

service varnish restart

In order to purge varnish cache for a specific URL, using CURL :


Running this command should provide an output like this :

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    <title>200 Varnish cache has been purged for this object.</title>
    <h1>Error 200 Varnish cache has been purged for this object.</h1>
    <p>Varnish cache has been purged for this object.</p>
    <h3>Guru Meditation:</h3>
    <p>XID: 1398586940</p>
    <p>Varnish cache server</p> <script defer src=""></script></body>

Clearing the varnish cache for a specific URL using varnishadm

To open the varnishadm console. use the following command to purge the URL :

varnishadm -T -S /etc/varnish/secret ban " == && req.url == /some/url/"
© 2024 WPOven Inc. All rights reserved. WPOven® and WordPress® are registered trademarks.
WPOven is the best Managed WordPress hosting for agencies and businesses that want to succeed. With Unlimited sites hosting option, its easy to use and manage, so you can focus on growing your business. 
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram