Created
August 1, 2016 14:10
-
-
Save wpottier/7dca182baa8bd3d2d4bd8b4ef0278a36 to your computer and use it in GitHub Desktop.
sample.vcl
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 (client.ip != "127.0.0.1" && std.port(server.ip) == 80 && req.http.host ~ "^(?i)example.com") { | |
set req.http.x-redir = "https://" + req.http.host + req.url; | |
return(synth(850, "Moved permanently")); | |
} | |
} | |
sub vcl_synth { | |
if (resp.status == 850) { | |
set resp.http.Location = req.http.x-redir; | |
set resp.status = 302; | |
return (deliver); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment