# Gzip gzip\_min\_length directives doesn't work in ajax?

**URL:** <https://www.ruby-forum.com/t/gzip-gzip-min-length-directives-doesnt-work-in-ajax/220894>\
**Category:** NGINX\
**Created:** [June 24, 2012, 10:55am UTC](https://www.ruby-forum.com/t/gzip-gzip-min-length-directives-doesnt-work-in-ajax/220894 "2012-06-24T10:55:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![aris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aris](https://www.ruby-forum.com/u/aris)\
**Post date:** [June 24, 2012, 10:55am UTC](https://www.ruby-forum.com/t/gzip-gzip-min-length-directives-doesnt-work-in-ajax/220894/1 "2012-06-24T10:55:14Z")

</div>

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](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

---

<div class="post-metadata">

**Author:** ![lhmwzy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/90db22/32.png) [@lhmwzy](https://www.ruby-forum.com/u/lhmwzy)\
**Post date:** [June 25, 2012, 12:11pm UTC](https://www.ruby-forum.com/t/gzip-gzip-min-length-directives-doesnt-work-in-ajax/220894/2 "2012-06-25T12:11:38Z")

</div>

Hello!

On Sun, Jun 24, 2012 at 04:54:28PM +0800, lhmwzy wrote:

> ```
> gzip_vary on;
> 
> ```
> 
> Connection keep-alive  
> Content-Encoding gzip  
> 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

The gzip\_min\_length directive doesn’t work if length isn’t known.

Maxim D.
