Ways to control the gzip_vary directive from nginx 0.6.34 and above?

Zev Blut zblut at cerego.co.jp
Tue Sep 15 09:38:48 MSD 2009


On 09/15/2009 01:47 PM, Jeff Waugh wrote:
> <quote who="Zev Blut">
>> Nginx 0.6.34 and above have changed the gzip_vary directive to add the
>> "Vary: Accept-Encoding" header to uncompressed responses as well as
>> compressed responses.
> This should only be the case for the matched gzip_types, though not *all*
> uncompressed responses. Have you included (inappropriate for compression)
> image and audio types in gzip_types? If so, remove them, and you should be
> done (unless there is a bug in nginx ->  but I haven't seen a similar thing
> happen on my servers).

I don't think I have, but just in case here is a copy of my gzip commands:
# Serve up static compressed items
gzip_static  on;

## Compression
gzip on;
gzip_http_version 1.1;
gzip_comp_level 2;
gzip_proxied any;
gzip_min_length  1100;
gzip_buffers 16 8k;
gzip_types text/plain text/html text/css application/x-javascript 
text/xml application/xml application/xml+rss text/javascript;
# Some version of IE 6 don't handle compression well on some mime-types, 
so just disable for them
gzip_disable "MSIE [1-6].(?!.*SV1)";
# Set a vary header so downstream proxies don't send cached gzipped 
content to IE6
gzip_vary on;

But with these commands things like jpgs and mp3s are still getting the 
Vary: Accept-Encoding header, even though they are not compressed.
Is there something I am missing?


More information about the nginx mailing list