Using Varnish 3.0.7. In order to forward any non-SSL connections I've added the following subroutine to my VCL:
sub vcl_synth {
if (resp.status == 750) {
set resp.status = 301;
set resp.http.Location = req.http.x-redir;
return(deliver);
}
}
And then in vcl_recv
I've added:
if ((req.http.host ~ "^(?i)mydomain(?i)") && req.http.X-Forwarded-Proto !~ "(?i)https") {
set req.http.x-redir = "https://" + req.http.host + req.url;
return(synth(750, ""));
}
But I'm getting the following error:
Message from VCC-compiler:
Expected return action name.
('input' Line 225 Pos 16)
return(synth(750, ""));
---------------#####------------
Does anyone know why this is happening? I'm clueless after several hours of debugging...
Many thanks!
vcl_synth
and return(synth(750, ""))
do not exists in Varnish Cache 3.x. That's valid syntax only in 4.x. In 3.x vcl_synth
should be replaced by vcl_error
and return(synth(750, ""))
by error 750
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With