gzip compression not taken into account?
Maxim Dounin
mdounin at mdounin.ru
Mon May 16 15:08:34 MSD 2011
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
More information about the nginx
mailing list