清漆 4:远程缓存 [英] Varnish 4 : Remote Cache
本文介绍了清漆 4:远程缓存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
美好的一天.我需要一些帮助,我无法在清漆中获得任何 HIT/MISS 响应.请帮助我.. 提前致谢..这是我的 default.vcl 配置.
Good day. I need some help, I cant get any HIT/MISS response in varnish. please help me.. thanks in advance.. Here is my default.vcl configuration.
backend default {
.host = "00.00.00.00";
.port = "80";
}
sub vcl_recv {
if (req.http.host == "www.example.com") {
unset req.http.cookie;
unset req.http.Vary;
}
else
{
return (pass);
}
}
sub vcl_backend_response {
set beresp.do_gzip = true;
unset beresp.http.Cache-Control;
set beresp.ttl = 1h;
set beresp.grace = 1w;
}
sub vcl_deliver {
if (obj.hits > 0) {
set resp.http.X-Cache = "HIT";
} else {
set resp.http.X-Cache = "MISS";
}
}
推荐答案
你声明的唯一后端是0.0.0.0
,你应该声明一个正确的后端ip或dns.
The only backend you declare is 0.0.0.0
, you should declare a correct backend ip or dns.
Varnish 是一个反向代理,它不会遵循 Header:Host => IP http 方式.需要明确声明将请求转发到哪里.
Varnish is a reverse proxy, it won't follow the Header:Host => IP http way. It needs to be explicitly declare where to forward the request.
这篇关于清漆 4:远程缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文