Skip to content

Instantly share code, notes, and snippets.

@gclitheroe
Created March 3, 2012 05:21
Show Gist options
  • Save gclitheroe/1964540 to your computer and use it in GitHub Desktop.
Save gclitheroe/1964540 to your computer and use it in GitHub Desktop.
Varnish BAN config
if (req.request == "DELETE") {
if (!client.ip ~ purge) {
error 405 "Not allowed.";
}
if (req.http.X-BanExpression) {
ban(req.http.X-BanExpression);
}
else {
ban_url(req.url);
}
# Throw a synthetic page so the
# request won't go to the backend.
error 200 "Ban added";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment