清漆3:使用“synth”时的“预期返回动作名称”

时间:2015-12-30 12:15:43

标签: ssl varnish varnish-vcl

使用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, "")); 
---------------#####------------

有谁知道为什么会这样?经过几个小时的调试后,我一无所知......

非常感谢!

1 个答案:

答案 0 :(得分:5)

Varnish Cache 3.x中不存在

vcl_synthreturn(synth(750, ""))。这只是4.x中的有效语法。 3.x vcl_synth应由vcl_errorreturn(synth(750, ""))替换为error 750