我需要为基于 cookie 的旁路对象执行自定义清漆 VCL 配置。因此,除非用户登录,否则 Varnish 会继续提供我的缓存页面。如何阻止对未登录用户的访问?对于特定页面或正则表达式等。
用:Nginx上的Varnish 3,Ubuntu 64。位 EC2 实例
这是清漆的默认行为,摘自默认配置 [1]:
sub vcl_recv {
#...
if (req.http.Authorization || req.http.Cookie) {
/* Not cacheable by default */
return (pass);
}
#...
}
[1] https://www.varnish-cache.org/docs/3.0/reference/vcl.html#examples