Created
June 14, 2011 10:46
-
-
Save bnoordhuis/1024668 to your computer and use it in GitHub Desktop.
[varnish] normalize Accept-Encoding header
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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