Last active
April 20, 2021 20:45
-
-
Save section-io-gists/e6c46bde97147e6ae7d1ff9989c7781a to your computer and use it in GitHub Desktop.
Redirect from bare domain to www site in VCL3
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") { | |
error 850 "Moved Permanently"; | |
} | |
} | |
sub vcl_error { | |
if(obj.status == 850) { | |
set obj.http.Location = "https://www." + req.http.host + req.url; | |
set obj.status = 301; | |
return(deliver); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment