gzip gzip_min_length directives doesn't work in ajax?

lhmwzy lhmwzy at gmail.com
Sun Jun 24 08:54:28 UTC 2012


 I have the following conf

http {
...
    gzip on;
    gzip_min_length 1000;
    gzip_buffers 16 64k;
    gzip_http_version 1.1;
    gzip_comp_level 6;
    gzip_types text/plain application/x-javascript text/css application/xml;
    gzip_vary on;
...

I notice that the gzip_min_length 1000; dirctives doesn't word in ajax.

the request header:

Host	10.66.23.99
Accept-Charset	GB2312,utf-8;q=0.7,*;q=0.7
(Request-Line)	GET /luapp/getname?query=dsfds HTTP/1.1
Accept-Encoding	gzip, deflate
Connection	keep-alive
User-Agent	Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0) Gecko/20100101
Firefox/5.0
Cookie	name=bq0xPMS+HUgGYuV7pB9f9j6l9qhcIdS3fABQDOlgsuY=;
returnurl=/app/images/shadow.png
Accept	text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language	zh-cn,zh;q=0.5

the response header:
(Status-Line)	HTTP/1.1 200 OK
Connection	keep-alive
Content-Encoding	gzip
Content-Type	text/html; charset=UTF-8
Date	Sun, 24 Jun 2012 08:37:05 GMT
Server	ngx_openresty/1.2.1.1
Transfer-Encoding	chunked
Vary	Accept-Encoding

the url:http://10.66.23.99/luapp/getname?query=dsfds
the return content:
{"query":"dsfds","suggestions":{}}
the size of return content is 35bytes,is smaller than gzip_min_length
in the conf,but it is still gziped,
the gzip resut:text/html; charset=UTF-8 : 35 bytes, gzip compressed to
55 bytes ( -57.1 % saving )

Why?
I'm using nginx 1.2.1



More information about the nginx mailing list