Welcome! Log In Create A New Profile

Advanced

Re: gzip compression not taken into account?

Maxim Dounin
May 16, 2011 07:10AM
Hello!

On Sat, May 14, 2011 at 05:51:33PM -0400, jfix wrote:

> Thanks Thomas for your reply.
>
> I've redone the test by explicitly supplying the proxy, and indeed it
> seems to remove the Accept-encoding header, as even with --compressed
> option, the response is now uncompressed:
>
> M:>curl --compressed -v -x wsg-proxy.example.org:80
> http://example.org/resource/style/global.css
> * About to connect() to proxy wsg-proxy.example.org port 80 (#0)
> * Trying 10.101.128.15... connected
> * Connected to wsg-proxy.oecd.org (10.101.128.15) port 80 (#0)
> > GET http://example.org/resource/style/global.css HTTP/1.1
> > User-Agent: curl/7.19.7 (i386-pc-win32) libcurl/7.19.7 OpenSSL/0.9.8l
> zlib/1.2.3
> > Host: example.org
> > Accept: */*
> > Accept-Encoding: deflate, gzip
> > Proxy-Connection: Keep-Alive
> >
> < HTTP/1.1 200 OK
> < Server: nginx
> < Date: Sat, 14 May 2011 21:46:49 GMT
> < Content-Type: text/css
> < Vary: Accept-Encoding
> < Last-Modified: Fri, 13 May 2011 16:00:36 GMT
> < Expires: Thu, 31 Dec 2037 23:55:55 GMT
> < Cache-Control: max-age=315360000
> < Content-Length: 43345
> < Age: 0
> < Via: 1.1 localhost.localdomain
>
> So, it looks like I have to talk to my company's IT people ... Thanks
> for your help.

Please note that by default nginx only returns compressed response
to HTTP/1.1 requests. By using proxy you may be in fact using
HTTP/1.0 in request to nginx.

Additionally, nginx will look though request headers to find out
if request was from proxy, and by default won't return compressed
response to proxies. With gzip_proxied as set in your config it
won't return response in question compressed as well.

See here for more details:

http://wiki.nginx.org/HttpGzipModule#gzip_http_version
http://wiki.nginx.org/HttpGzipModule#gzip_proxied

Please also note that unconditionally enabling gzip for everything
may not be a good idea. If enabling gzip for proxied requests,
please at least make sure that (a) gzip_vary set to on and (b)
gzip for HTTP/1.0 is disabled (default).

Maxim Dounin

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

gzip compression not taken into account?

jfix May 13, 2011 04:09PM

Re: gzip compression not taken into account?

Dan Trainor May 13, 2011 04:22PM

Re: gzip compression not taken into account?

Jocelyn May 13, 2011 07:02PM

Re: gzip compression not taken into account?

jfix May 14, 2011 12:22PM

Re: gzip compression not taken into account?

jfix May 14, 2011 05:51PM

Re: gzip compression not taken into account?

Thomas Love May 14, 2011 05:38PM

Re: gzip compression not taken into account?

Maxim Dounin May 16, 2011 07:10AM

Re: gzip compression not taken into account?

jfix May 16, 2011 07:29AM

Re: gzip compression not taken into account?

Thomas Love May 16, 2011 10:00AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 313
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready