Welcome! Log In Create A New Profile

Advanced

Re: gzip compression not taken into account?

May 14, 2011 12:22PM
Thanks for your replies, I will try to provide more information (I'm quite new with nginx).

Traffic passes through the company firewall/proxy server, so potentially things could get mangled there. I guess there is no way to inspect the requested headers as received by the server? I set the error_log level to debug_http, but it doesn't seem to log headers.

One interesting detail: Using curl and explicitly requesting a compressed response like this, I get this result:

M:>curl -v --compressed http://example.org/
* About to connect() to example.org port 80 (#0)
* Trying xx.xx.xx.xx... connected
* Connected to example.org (xx.xx.xx.xx) port 80 (#0)
> GET / 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
>
< HTTP/1.1 200 OK
< Server: nginx
< Date: Sat, 14 May 2011 16:10:06 GMT
< Content-Type: text/html; charset=UTF-8
< Transfer-Encoding: chunked
< Connection: keep-alive
< Vary: Accept-Encoding
< Content-Encoding: gzip
<
10.107.145.6 - - [14/May/2011:18:10:06 +0000] "GET / HTTP/1.1" 200 2671 "-" "curl/7.19.7 (i386-pc-win32) libcurl/7.19.7 OpenSSL/0.9.81 zlib/1.2.3 "-" "0.031" "2.53"

where the last item "2.53" is the compression ratio.

M:>curl -v --compressed http://example.org/resource/style/global.css
* About to connect() to example.org port 80 (#0)
* Trying xx.xx.xx.xx... connected
* Connected to example.org (xx.xx.xx.xx) port 80 (#0)
> GET /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
>
< HTTP/1.1 200 OK
< Server: nginx
< Date: Sat, 14 May 2011 16:14:38 GMT
< Content-Type: text/css
< Transfer-Encoding: chunked
< Connection: keep-alive
< 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-Encoding: gzip

10.107.145.6 - - [14/May/2011:18:14:38 +0000] "GET / HTTP/1.1" 200 7917 "-" "curl/7.19.7 (i386-pc-win32) libcurl/7.19.7 OpenSSL/0.9.81 zlib/1.2.3 "-" "0.000" "5.48"

So, this means that compression does work in theory, but it doesn't unless I request it. The following example is the same as the previous one, but without the --compressed:

M:>curl -v http://example.org/resource/style/global.css
* About to connect() to example.org port 80 (#0)
* Trying xx.xx.xx.xx... connected
* Connected to example.org (xx.xx.xx.xx) port 80 (#0)
> GET /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: */*
>
< HTTP/1.1 200 OK
< Server: nginx
< Date: Sat, 14 May 2011 16:16:59 GMT
< Content-Type: text/css
< Connection: keep-alive
< Vary: Accept-Encoding
< Content-Length: 43345
< Last-Modified: Fri, 13 May 2011 16:00:36 GMT
< Expires: Thu, 31 Dec 2037 23:55:55 GMT
< Cache-Control: max-age=315360000

10.107.145.6 - - [14/May/2011:18:16:59 +0000] "GET / HTTP/1.1" 200 43345 "-" "curl/7.19.7 (i386-pc-win32) libcurl/7.19.7 OpenSSL/0.9.81 zlib/1.2.3 "-" "0.000" "-"

I'm not sure what the --compressed option translates to in terms of headers, but it makes a difference. The last examples is what I get when I user a browser (Chrome and Firefox tested).

Thanks for your help,
Jakob.
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: 55
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready