# Gzip filter on streaming responses

**URL:** <https://www.ruby-forum.com/t/gzip-filter-on-streaming-responses/223731>\
**Category:** NGINX\
**Created:** [October 15, 2012, 11:33pm UTC](https://www.ruby-forum.com/t/gzip-filter-on-streaming-responses/223731 "2012-10-15T23:33:39Z")\
**Posts on this page:** 4\
**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:** [October 15, 2012, 11:33pm UTC](https://www.ruby-forum.com/t/gzip-filter-on-streaming-responses/223731/1 "2012-10-15T23:33:39Z")

</div>

I did some investigation and the gzip filter will only activate if there  
is a Content-Length header with valid length.

Is there any way of deflating streaming responses from the nginx push  
stream module? Where is there isn’t a known content length, but  
potential for thousands of messages to be transferred?

Regards,

John

---

<div class="post-metadata">

**Author:** ![princenamor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/c0e974/32.png) [@princenamor](https://www.ruby-forum.com/u/princenamor)\
**Post date:** [October 15, 2012, 11:58pm UTC](https://www.ruby-forum.com/t/gzip-filter-on-streaming-responses/223731/2 "2012-10-15T23:58:11Z")

</div>

Have you tried?

```
       gzip on;
       gzip_min_length 0;

```

Regards,

Justin D. [http://www.twitter.com/jdorfman](http://www.twitter.com/jdorfman)

NetDNA [http://www.netdna.com](http://www.netdna.com)  
The Science of Acceleration

---

<div class="post-metadata">

**Author:** ![princenamor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/c0e974/32.png) [@princenamor](https://www.ruby-forum.com/u/princenamor)\
**Post date:** [October 16, 2012, 12:41pm UTC](https://www.ruby-forum.com/t/gzip-filter-on-streaming-responses/223731/3 "2012-10-16T12:41:50Z")

</div>

Hello!

On Mon, Oct 15, 2012 at 02:32:44PM -0700, John W. wrote:

> I did some investigation and the gzip filter will only activate if there  
> is a Content-Length header with valid length.

This is not true. With Content-Length present gzip filter is able  
to more effectively allocate buffers (or skip responses as per  
gzip\_min\_length), but it isn’t limited to responses with  
Content-Length present.

> Is there any way of deflating streaming responses from the nginx push  
> stream module? Where is there isn’t a known content length, but  
> potential for thousands of messages to be transferred?

As long as push stream module does things correctly it should  
work, but that’s the question more about (3rd party) push stream  
module, not gzip filter.

–  
Maxim D.

> **[F5 NGINX: Built for cloud-native apps. Ready for AI traffic.](https://www.f5.com/products/nginx)**
>
> Deliver modern applications with NGINX. Explore high-performance load balancing, API gateways, and web server solutions trusted by top global enterprises.

---

<div class="post-metadata">

**Author:** ![princenamor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/c0e974/32.png) [@princenamor](https://www.ruby-forum.com/u/princenamor)\
**Post date:** [October 16, 2012, 8:54pm UTC](https://www.ruby-forum.com/t/gzip-filter-on-streaming-responses/223731/4 "2012-10-16T20:54:05Z")

</div>

That makes much more sense. Thank you for clarifying how the gzip filter  
works.

There is a patch forthcoming for the push stream module that adds the  
necessary information to get gzip working.

Regards,

John
