清漆 3:使用 "synth" 时 "Expected return action name"

Varnish 3: "Expected return action name" when using "synth"

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

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

非常感谢!

vcl_synthreturn(synth(750, "")) 不存在于清漆缓存 3.x 中。这是仅在 4.x 中有效的语法。在 3.x 中,vcl_synth 应替换为 vcl_errorreturn(synth(750, "")) 应替换为 error 750