Varnish

From Tafoya.co
Revision as of 18:35, 11 January 2015 by Aetafoya (talk | contribs) (Created page with "== Redirect to HTTPS == sub vcl_recv { if ( (req.http.host ~ "^(?i)www.domain.com") && req.http.X-Forwarded-Proto !~ "(?i)https") { return (synth(750,...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Redirect to HTTPS

sub vcl_recv {
       if ( (req.http.host ~ "^(?i)www.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);
   }
}