Skip to content

Instantly share code, notes, and snippets.

@bnoordhuis
Created June 14, 2011 10:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bnoordhuis/1024668 to your computer and use it in GitHub Desktop.
Save bnoordhuis/1024668 to your computer and use it in GitHub Desktop.
[varnish] normalize Accept-Encoding header
# normalize Accept-Encoding header
if (req.http.Accept-Encoding) {
if (req.url ~ "\.(jpeg|jpg|png|gif|gz|tgz|bz2|tbz|zip|flv|pdf|mp3|ogg)$") {
remove req.http.Accept-Encoding; # already compressed
}
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 {
remove req.http.Accept-Encoding;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment