【问题标题】:varnish 4.0 VCL error : Running VCC-compiler failedvarnish 4.0 VCL 错误:运行 VCC 编译器失败
【发布时间】:2015-05-24 08:37:28
【问题描述】:

我用的是varnish 4.0,按照这些操作,

vi /etc/varnish/default.vcl

# Drop any cookies sent to WordPress.
sub vcl_recv {
     if ((req.url ~! "wp- (login | admin)")) {
         unset req.http.cookie;
     }
}

# Drop any cookies WordPress tries to send back to the client.
sub vcl_backend_response {
     if ((req.url ~! "wp- (login | admin)")) {
         unset beresp.http.set-cookie;
     }
}

执行此命令时我 /etc/init.d/varnish 重启

收到此错误消息。

Message from VCC-compiler:
Syntax error at
('input' Line 33 Pos 1)
    if (!(req.url ~ "wp-(login|admin)")) {
#-------------------------------------------

Running VCC-compiler failed, exited with 2

VCL compilation failed
 * Syntax check failed, not restarting

那么,如何解决这个问题?

谢谢!

【问题讨论】:

    标签: wordpress varnish varnish-vcl


    【解决方案1】:

    正如documentation 所说:

    req.* 在 vcl_backend_response 中不可用

    req.* 曾经可用 在 vcl_fetch 中,但是在功能拆分之后,你只有 vcl_backend_response 中的“bereq.*”。

    【讨论】:

    猜你喜欢
    • 2021-10-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-09-13
    • 2013-12-01
    • 2019-03-13
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多