Last active
November 30, 2019 17:46
-
-
Save ricsiga/45a7124f9a4d3869852c50fc0e959810 to your computer and use it in GitHub Desktop.
redirect in Varnish 4
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.http.host == "www.example.com") { | |
set req.http.location = "http://example.com" + req.url; | |
return (synth(750, "Permanently moved")); | |
} | |
} | |
sub vcl_synth { | |
if (resp.status == 750) { | |
set resp.http.location = req.http.location; | |
set resp.status = 301; | |
return (deliver); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment