ab -n 1 -H 'Accept-Encoding: gzip, deflate' http://mywebsite.com/
This always returns the uncompressed content (I can see that both from its size and because I'm sniffing the traffic with ngrep
).
However, if I request the content with Firefox, the result is compressed. Content-Encoding: gzip
it says. I've tried to specify with ab
all request headers Firefox specifies, as I see them sniffed, but still ab
gets it uncompressed and Firefox gets it compressed.
I'm running a version of nginx which I have compiled myself but is identical to the Debian squeeze backports 1.2.1 version, except that it has the syslog patch. ApacheBench 2.3 revision 655654. Here is the nginx gzip configuration:
gzip on;
gzip_min_length 1000;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
gzip_vary on;
The document type is text/html
(not listed above but always compressed by nginx; besides, I tried adding it, with no difference). It is dynamic, received from a uwsgi
backend.
Sniffed request headers from ab
:
GET [...] HTTP/1.0.
Accept-Encoding: gzip, deflate.
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8.
User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:23.0) Gecko/20100101 Firefox/23.1.
Accept-Language: en-US,en;q=0.5.
Cookie: csrftoken=[...].
Authorization: Basic [....].
Connection: keep-alive.
Host: [...].
Sniffed request headers from Firefox:
GET [...] HTTP/1.1.
Host: [...].
User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:23.0) Gecko/20100101 Firefox/23.0.
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8.
Accept-Language: en-US,en;q=0.5.
Accept-Encoding: gzip, deflate.
Cookie: csrftoken=[...].
Authorization: Basic [...].
Connection: keep-alive.
Hmmm, maybe it could be the protocol version.