Regex 清漆3 VCL正则表达式
我一直在努力匹配varnish 3 vcl中的这个url模式 www.example.com/alpha/76/Permanent/Regex 清漆3 VCL正则表达式,regex,caching,varnish,Regex,Caching,Varnish,我一直在努力匹配varnish 3 vcl中的这个url模式 www.example.com/alpha/76/Permanent/ if ((req.url ~ "/*/*/Permanent/$")) { set beresp.http.Cache-Control = "public, max-age=1400, s-maxage=1400"; set beresp.ttl = 30m; return(deliver); } 但这似乎不符合条件。知道我错在哪里吗?/*表示
if ((req.url ~ "/*/*/Permanent/$")) {
set beresp.http.Cache-Control = "public, max-age=1400, s-maxage=1400";
set beresp.ttl = 30m;
return(deliver);
}
但这似乎不符合条件。知道我错在哪里吗?
/*
表示零个或多个斜杠(这不是)。你应使用:
^/\w+/\w+/Permanent/$
\w+
将匹配一个或多个字母数字字符
来源:它也匹配这个:example.com/Apha/Beta/222/194442/Permanent/,可以做什么,它只匹配这个模式example.com/alpha/76/Permanent/@GoodtheBesT例如,你可以使用
/\w+/\w+/Permanent/$
-这将只匹配字母数字字符。但它可能仍然匹配URL的结尾…但它仍然与example.com/Apha/Beta/222/194442/Permanent/和example.com/alpha/76/Permanent/模式匹配。虽然我希望它只与以下模式匹配:example.com/alpha/76/Permanent/@GoodtheBesT-在开始时尝试^
:^/\w+/\w+/Permanent/$
:^worked,但如果排除www.example.com而不是缓存,而是缓存其他文件夹和页面,该怎么办?我们可以排除带有任何条件的登录页吗?