在Firefox上,Varnish正在发挥作用,但在谷歌浏览器上却没有。可能?为什么呢?
答案 0 :(得分:3)
另一个可能的原因可能是您在Chrome中有一个会话cookie,导致Varnish将请求传递给后端。
答案 1 :(得分:1)
最可能的原因是Accept-Encoding标头的规范化,Firefox和Chrome都发送了不同的标头。将其添加到您的子vcl_recv():
if (req.http.Accept-Encoding) {
if (req.url ~ "\.(jpg|png|gif|gz|tgz|bz2|tbz|mp3|ogg)$") {
# No point in compressing these
remove req.http.Accept-Encoding;
} elsif (req.http.Accept-Encoding ~ "gzip") {
set req.http.Accept-Encoding = "gzip";
} elsif (req.http.Accept-Encoding ~ "deflate") {
set req.http.Accept-Encoding = "deflate";
} else {
# unkown algorithm
remove req.http.Accept-Encoding;
}
}
中
答案 2 :(得分:0)
if (req.http.Accept-Encoding) {
if (req.http.Accept-Encoding ~ "gzip") {
set req.http.Accept-Encoding = "gzip";
} elsif (req.http.Accept-Encoding ~ "deflate") {
set req.http.Accept-Encoding = "deflate";
} else {
# unknown language. Remove the accept-language header and
# use the backend default.
unset req.http.Accept-Encoding;
}
}
//add below condition along with above code in vcl_recv subroutine.
if(req.http.User-Agent) {
unset req.http.User-Agent;
}