1分钟
配置Banning操作
(1) varnishadm:
ban <field> <operator> <arg>
示例:
ban req.url ~ (?i)^/javascripts
(2) 在配置文件中定义,使用ban()函数;
示例:
if (req.method == “BAN”) {
ban(“req.http.host == ” + req.http.host + ” && req.url == ” + req.url);
# Throw a synthetic page so the request won’t go to the backend.
return(synth(200, “Ban added”));
}
curl -X BAN http://www.ilinux.io/test1.html
ban req.http.host==www.ilinux.io && req.url==/test1.html
学员评价