varnish 4.0 VCL错误:运行VCC编译器失败

时间:2015-03-20 20:04:08

标签: wordpress varnish varnish-vcl

我使用清漆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

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

谢谢!

1 个答案:

答案 0 :(得分:1)

正如documentation所说:

  

req。*在vcl_backend_response

中不可用      

req。*曾经可用   在vcl_fetch中,但在功能拆分之后,你只有   ' bereq *'在vcl_backend_response。