Reputation: 6609
On Firefox, Varnish is in play, but not on Google Chrome. Possible? Why?
Upvotes: 4
Views: 3379
Reputation: 387
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;
}
Upvotes: 0
Reputation: 191
One other possible reason could be that you have a session cookie in Chrome that causes Varnish to pass the request to the backend.
Upvotes: 4
Reputation: 1373
The most likely cause is normalization of the Accept-Encoding header, both Firefox and Chrome send a different one. Add this to your sub 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;
}
}
This is also documented in the Varnish manual on the "Vary" header.
Upvotes: 1