gzip compression not taken into account?
jfix
nginx-forum at nginx.us
Sat May 14 20:22:08 MSD 2011
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.
Posted at Nginx Forum: http://forum.nginx.org/read.php?2,197898,198024#msg-198024
More information about the nginx
mailing list