![]()
To configure PURGE add this lines into your VCL_RECV:
vcl 4.0;
import std;
sub vcl_recv {
# Allow banning
if (req.method == "BAN") {
# Same ACL check as above:
if (!client.ip ~ purge) {
return(synth(405, "This IP is not allowed to send BAN requests."));
}
ban("req.http.host == " + req.http.host + " && req.url == " + req.url);
# Throw a synthetic page so the request won't go to the backend.
return(synth(200, "Ban added"));
}
}
To test it:
$ curl -v -k -H "host: www.mydomain.com" -X BAN http://varnish_server_ip/
