【问题标题】:Varnish 3: "Expected return action name" when using "synth"Varnish 3:使用“synth”时的“预期返回动作名称”
【发布时间】:2016-04-04 10:04:21
【问题描述】:

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

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

非常感谢!

【问题讨论】:

    标签: ssl varnish varnish-vcl


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 2021-08-29
      • 1970-01-01
      • 1970-01-01
      • 2020-03-20
      • 2021-10-04
      • 2018-03-19
      • 2020-01-12
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多