Clear all
curl -X BAN http://<VarnishServerIP>/
Clear specific cached file.
curl -X BAN http://<VarnishServerIP>/static/images.png
if (req.request == "BAN") {
if (!client.ip ~ ClearCache) {
error 405 "Not allowed.";
}
# This option is to clear any cached object containing the req.url
ban("req.url ~ "+req.url);
# This option is to clear any cached object matches the exact req.url
# ban("req.url == "+req.url);
# This option is to clear any cached object containing the req.url
# AND matching the hostname.
# ban("req.url ~ "+req.url+" && req.http.host == "+req.http.host);
error 200 "Cached Cleared Successfully.";
}