我有一个目前可以工作的清漆 3.xx 服务器。Varnish 正在缓存我网站的登录页面。
www.mysite.com/staff
但它可能有不同的 url,具体取决于工作人员的链接,例如
www.mysite.com/staff/index.php?/Tickets/Ticket/View/222200
我的清漆配置文件设置如下,以排除缓存员工页面,但它不起作用,因为它正在缓存登录页面,并且在我重新启动清漆以清除它的缓存之前它不会登录。
sub vcl_recv {
# Allow purge only from internal users
if (req.request == "PURGE") {
if (!client.ip ~ internal_net) {
error 405 "Not allowed.";
}
return (lookup);
# Exclude the following
if (req.url ~ "^/login\.php" ||
req.url ~ "^/search\.php" ||
req.url ~ "^/admin(.*)" ||
req.url ~ "^/admin(.*)" ||
req.url ~ "^/search(.*)" ||
req.url ~ "^/visitor(.*)" ||
req.url ~ "^/staff(.*)" ||
req.url ~ "^/staff\.php"
) {
return(pass);
}
if (req.http.cookie ~ "vb(.*)" ||
req.http.cookie ~ "bb(.*)" ||
req.http.cookie ~ "SWIFT_(.*)" ||
req.url ~ "\?(.*\&)?s=[a-fA-F0-9]{32}(\&|$)" ||
req.http.cookie ~ "bb_password") {
return(pass);
} else {
unset req.http.cookie;
}
}
您是否有另一种方法可以排除整个目录并使其不被缓存?IE:来自 /staff 的所有内容,无论后缀是什么,都不得缓存