Gzip_disable and vary header

Hi,

A while ago we were having some troubles with gzip and old IE6. I then
found this blog entry which seemed to solve my troubles:

However immediately after applying this fix to our Nginx config files I
realised that there was still something wrong. If gzip_disable acts on
the User-Agent to enable/disable compression, shouldn’t gzip_vary act on
this too? In other words shouldn’t it send this header?:

Vary: Accept-Encoding, User-Agent

Attached patch modifies Nginx 0.6 to send above header when both
gzip_vary and gzip_disable are being used. It reverts back to the old
behaviour of sending only Accept-Encoding in the Vary header if
gzip_disable is not in use.

Feedback appreciated.

Regards,

Matthijs van der Klip

Hello,

On Apr 2, 2009, at 15:48 , Spil G. wrote:

realised that there was still something wrong. If gzip_disable acts on
the User-Agent to enable/disable compression, shouldn’t gzip_vary
act on
this too? In other words shouldn’t it send this header?:

Vary: Accept-Encoding, User-Agent

I’ve found yet another resource that indicate that the current
behavior of nginx is incorrect:

I can’t find what SPEC it is relying on, but as far as other
discussions on The Internets go, I think that Accept-encoding is
indeed required.

Attached patch modifies Nginx 0.6 to send above header when both
gzip_vary and gzip_disable are being used. It reverts back to the old
behaviour of sending only Accept-Encoding in the Vary header if
gzip_disable is not in use.

Feedback appreciated.

I can confirm that this works as intended. I’ve attached a patch
against nginx 0.8.4 which is based on the earlier patch.

Posted via http://www.ruby-forum.com/.

Thanks,
Johan

On Jun 25, Johan Bergström wrote:

I can’t find what SPEC it is relying on, but as far as other discussions on
The Internets go, I think that Accept-encoding is indeed required.

Accept-Encoding most definitely needs to go as part of Vary when gzip in
place. While adding User-Agent to Vary seems tempting, it has a side
effect of severely decreasing your cache-hit ratio since every
build/patch of a browser has a different UA string.

Arvind Jayaprakash wrote:

Accept-Encoding most definitely needs to go as part of Vary when gzip in
place. While adding User-Agent to Vary seems tempting, it has a side
effect of severely decreasing your cache-hit ratio since every
build/patch of a browser has a different UA string.

Most defenitely true, but the alternative is having either the
compressed or uncompressed version of a response being cached depending
on “luck”. If you want to prevent the cache-hit ratio problem, you
should avoid using the gzip_disable feature if you ask me.