使用Varnish 3.0.7。为了转发任何非SSL连接,我已将以下子例程添加到我的VCL:
sub vcl_synth {
if (resp.status == 750) {
set resp.status = 301;
set resp.http.Location = req.http.x-redir;
return(deliver);
}
}
然后在vcl_recv
我添加了:
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, ""));
}
但我收到以下错误:
Message from VCC-compiler:
Expected return action name.
('input' Line 225 Pos 16)
return(synth(750, ""));
---------------#####------------
有谁知道为什么会这样?经过几个小时的调试后,我一无所知......
非常感谢!
答案 0 :(得分:5)
vcl_synth
和return(synth(750, ""))
。这只是4.x中的有效语法。 3.x vcl_synth
应由vcl_error
和return(synth(750, ""))
替换为error 750
。