Skip to content

Instantly share code, notes, and snippets.

View tufahu's full-sized avatar

Milan Osztromok tufahu

  • w5labs
View GitHub Profile
@section-io-gists
section-io-gists / ForceHTTPSVarnish4.vcl
Last active July 29, 2020 12:28
Varnish 4.x to force HTTPS
sub vcl_recv {
if (req.http.X-Forwarded-Proto !~ "https") {
return (synth(850, "Moved Permanently"));
}
}
sub vcl_synth {
if(resp.status == 850) {
set resp.http.Location = "https://" + req.http.host + req.url;
set resp.status = 301;