How to clear complete cache in Varnish? : <p>I'm looking for a way to clear the cache for all domains and all URLs in Varnish.</p>

<p>Currently, I would need to issue individual commands for each URLs, for example:</p>

<pre><code>curl -X PURGE http://example.com/url1
curl -X PURGE http://example.com/url1
curl -X PURGE http://subdomain.example.com/
curl -X PURGE http://subdomain.example.com/url1
// etc.
</code></pre>

<p>While I'm looking for a way to do something like</p>

<pre><code>curl -X PURGE http://example.com/*
</code></pre>

<p>And that would clear all URLs under example.com, but also all URLs in sub-domains of example.com, basically all the URLs managed by Varnish.</p>

<p>Any idea how to achieve this?</p>

<p>This is my current VCL file:</p>

<pre><code>vcl 4.0;

backend default {
    .host = "127.0.0.1";
    .port = "8080";
}

sub vcl_recv {
    # Command to clear the cache
    # curl -X PURGE http://example.com
    if (req.method == "PURGE") {
        return (purge);
    }
}
</code></pre>
