Skip to content

Commit

Permalink
[VCL] Add missing BAN from Bundle vcl
Browse files Browse the repository at this point in the history
  • Loading branch information
andrerom committed Oct 25, 2017
1 parent ee8b17c commit 0e53a01
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions doc/varnish/vcl/varnish4_xkey.vcl
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,22 @@ sub vcl_backend_response {
// You may add FOSHttpCacheBundle tagging rules
// See http://foshttpcache.readthedocs.org/en/latest/varnish-configuration.html#id4
sub ez_purge {

# Support how purging was done in earlier versions, this is deprecated and here just for BC for code still using it
if (req.method == "BAN") {
if (!client.ip ~ invalidators) {
return (synth(405, "Method not allowed"));
}

if (req.http.X-Location-Id) {
ban("obj.http.X-Location-Id ~ " + req.http.X-Location-Id);
if (client.ip ~ debuggers) {
set req.http.X-Debug = "Ban done for content connected to LocationId " + req.http.X-Location-Id;
}
return (synth(200, "Banned"));
}
}

if (req.method == "PURGE") {
if (!client.ip ~ invalidators) {
return (synth(405, "Method not allowed"));
Expand Down

0 comments on commit 0e53a01

Please sign in to comment.