Skip to content

Instantly share code, notes, and snippets.

@stormslowly
Forked from ufo22940268/default.vcl
Created December 3, 2015 08:23
Show Gist options
  • Save stormslowly/3503c9b851d4b733af33 to your computer and use it in GitHub Desktop.
Save stormslowly/3503c9b851d4b733af33 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