Skip to content

Instantly share code, notes, and snippets.

@ufo22940268
Created December 3, 2015 08:20
Show Gist options
  • Save ufo22940268/86a894b7a4eed15f89e4 to your computer and use it in GitHub Desktop.
Save ufo22940268/86a894b7a4eed15f89e4 to your computer and use it in GitHub Desktop.
vcl 4.0;
acl purgers {
"localhost";
"127.0.0.1";
"192.168.199.0"/24;
}
backend default {
.host = "localhost";
.port = "3000";
}
sub vcl_backend_response {
set beresp.http.url = bereq.url;
}
sub vcl_deliver {
if (resp.status != 200) {
ban("obj.http.url == " + resp.http.url);
}
unset resp.http.url; # Optional
}
sub vcl_recv {
if (req.method == "PURGE") {
if (!client.ip ~ purgers) {
return (synth(405));
}
return (purge);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment