我一直在尝试通过服务器向无效的缓存内容发送BAN
请求。该 url 包含一些供 Varnish 检查的正则表达式。我已成功发送此请求:curl
Varnish
1.
curl -X BAN "https://oursite.com/product/item/(100|7|9||8|7|6|5|4|2|1)"
<!DOCTYPE html>
<html>
<head>
<title>200 Ban added</title>
</head>
<body>
<h1>Error 200 Ban added</h1>
<p>Ban added</p>
<h3>Guru Meditation:</h3>
<p>XID: 66211</p>
<hr>
<p>Varnish cache server</p>
</body>
</html>
但有一个更复杂的网址
2.
curl -X BAN "https://oursite.com/product/(search/home$|item/(391|1232))"
// What I'm trying to remove are:
1./product/search/home
2./product/item/391
3./product/item/1232
默认.vcl
if (req.method == "BAN") {
if (!client.ip ~ purge) {
return(synth(403, "Not allowed."));
}
ban("req.url ~ ^"+req.url);
return(synth(200, "Ban added"));
}
清漆日志:
* << BeReq >> 163855
- Begin bereq 163854 pass
- Timestamp Start: 1450969228.080453 0.000000 0.000000
- BereqMethod BAN
- BereqURL /product/(search/home$|item/(391|1232))
- BereqProtocol HTTP/1.1
- BereqHeader User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.19.1 Basic ECC zlib/1.2.3 libidn/1.18 libssh2/1.4.2
- BereqHeader Host: oursite.com
curl 请求已成功发出,如图所示varnishlog
,但我不知道为什么正则表达式不起作用。没有任何页面被清除。谁能告诉我有什么问题?我需要逃脱哪些角色?