Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sub vcl_recv{
- if (req.http.host == "exampledomain.com") {
- set req.http.Location = "https://www.exampledomain.com" + req.url;
- error 750 "Permanently moved";
- }
- if ( (req.http.host ~ "(?i)www.exampledomain.com") && (req.http.X-Forwarded-Proto !~ "(?i)https") ) {
- set req.http.x-redir-url = "https://www.exampledomain.com" + req.url;
- error 751 req.http.x-redir-url;
- }
- if ( (req.http.host ~ "(?i)www.exampledomain.com") && (req.http.X-Forwarded-Port == "80") ) {
- set req.http.x-redir-url = "https://www.exampledomain.com" + req.url;
- error 751 req.http.x-redir-url;
- }
- }
- sub vcl_error {
- if (obj.status == 750) {
- set obj.http.location = req.http.Location;
- set obj.status = 301;
- return (deliver);
- }
- if (obj.status == 751) {
- set obj.http.Location = obj.response;
- set obj.status = 302;
- return (deliver);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement