Last active
April 20, 2021 20:45
-
-
Save section-io-gists/f5e772842947255cd22fce71b762afdf to your computer and use it in GitHub Desktop.
Redirect from bare domain to www site in VCL4.0
This file contains hidden or 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") { | |
return (synth(850, "Moved Permanently")); | |
} | |
} | |
sub vcl_synth { | |
if(resp.status == 850) { | |
set resp.http.Location = "https://www." + req.http.host + req.url; | |
set resp.status = 301; | |
return(deliver); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What about removing the www?