有人能告诉我如何解决这个Varnish错误吗?

时间:2011-08-06 15:30:40

标签: varnish varnish-vcl

这是我得到的错误:

来自VCC编译器的消息:

处的未终止字符串

(输入第39行Pos 19)

if (req.url ~ "^/[^?]+.(jpeg|jpg|png|gif|ico|js|css|txt|gz|

------------------ ############################# ################

运行VCC编译器失败,退出1 VCL编译失败

这是default.vcl

    backend default {
     .host = "localhost";
     .port = "8080";
}
acl purge {
        "localhost";
}
sub vcl_recv {
        if (req.request == "PURGE") {
                if (!client.ip ~ purge) {
                        error 405 "Not allowed.";
                }
                return(lookup);
        }
if (req.url ~ "^/$") {
               unset req.http.cookie;
            }
}
sub vcl_hit {
        if (req.request == "PURGE") {
                set obj.ttl = 0s;
                error 200 "Purged.";
        }
}
sub vcl_miss {
        if (req.request == "PURGE") {
                error 404 "Not in cache.";
        }
if (!(req.url ~ "wp-(login|admin)")) {
                        unset req.http.cookie;
                }
    if (req.url ~ "^/[^?]+.(jpeg|jpg|png|gif|ico|js|css|txt|gz|
zip|lzma|bz2|tgz|tbz|html|htm)(\?.|)$") {
       unset req.http.cookie;
       set req.url = regsub(req.url, "\?.$", "");
    }
    if (req.url ~ "^/$") {
       unset req.http.cookie;
    }
}
sub vcl_fetch {
        if (req.url ~ "^/$") {
                unset beresp.http.set-cookie;
        }
if (!(req.url ~ "wp-(login|admin)")) {
                        unset beresp.http.set-cookie;
}
}

2 个答案:

答案 0 :(得分:1)

嗯,显然你不能在字符串的中间换行。将字符串的尾端向上移动到它开始的行,或者有两个不同的字符串并用+连接它们。

答案 1 :(得分:1)

如果你想要一个长串,你可以使用{“你好 世界
我很长“}