Apache2 + varnish 4 + nginx
the code I use in varnish/default.vcl
redirects
but not
I searched over internet and tried to redirect in .htaccess, nginx, but no success. Is there any way to do this?
The code I used
sub vcl_recv {
if ( (req.http.host ~ "^(?i)www.domain.com" || req.http.host ~ "^(?i)domain.com") && req.http.X-Forwarded-Proto !~ "(?i)https") {
return (synth(750, ""));
}
}
sub vcl_synth {
if (resp.status == 750) {
set resp.status = 301;
set resp.http.Location = "https://www.domain.com" + req.url;
return(deliver);
}
}