Forum: NGINX gzip_disable and vary header

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
5ada1800aed8e23b28de817fe9394e31?d=identicon&s=25 Spil Games (spilgames)
on 2009-04-02 15:48
Attachment: nginx-0.6.35-gzip_vary.patch (1 KB)
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:

http://robsanheim.com/2008/02/07/beware-the-defaul...


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
E6595fe908f559e34b87c313ad1b7312?d=identicon&s=25 Johan Bergström (Guest)
on 2009-06-25 13:45
(Received via mailing list)
Attachment: nginx-0.8.4-gzip_vary.patch (1 KB)
Hello,

On Apr 2, 2009, at 15:48 , Spil Games 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:
http://redbot.org/?uri=http%3A%2F%2Fnginx.net

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
B9340b8cfd6b4038536e58327ef648c9?d=identicon&s=25 Arvind Jayaprakash (Guest)
on 2009-06-29 22:18
(Received via mailing list)
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.
5ada1800aed8e23b28de817fe9394e31?d=identicon&s=25 Spil Games (spilgames)
on 2009-06-30 09:15
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.
This topic is locked and can not be replied to.