Created
February 27, 2014 21:42
-
-
Save kriswallsmith/9260178 to your computer and use it in GitHub Desktop.
Here's a decent Chef workaround for Varnish's lack of support for ACL behind a proxy.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub vcl_recv { | |
if (req.url ~ "(?i)^/admin" && req.http.x-forwarded-for !~ "\b(<%= @ips.map{ |ip| Regexp.escape(ip) }.join('|') %>)$") { | |
error 750 "Moved Temporarily"; | |
} | |
} | |
sub vcl_error { | |
if (obj.status == 750) { | |
set obj.http.Location = "/"; | |
set obj.status = 302; | |
return(deliver); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment