# How to disable chunked transfer-encoding

**URL:** <https://www.ruby-forum.com/t/how-to-disable-chunked-transfer-encoding/169512>\
**Category:** NGINX\
**Created:** [June 4, 2009, 6:33pm UTC](https://www.ruby-forum.com/t/how-to-disable-chunked-transfer-encoding/169512 "2009-06-04T18:33:58Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ZhangSTony](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/e99b99/32.png) [@ZhangSTony](https://www.ruby-forum.com/u/ZhangSTony)\
**Post date:** [June 4, 2009, 6:33pm UTC](https://www.ruby-forum.com/t/how-to-disable-chunked-transfer-encoding/169512/1 "2009-06-04T18:33:58Z")

</div>

Hi

I found that Nginx set chunked transfer-encoding as default, so how can  
I disable this transfer-encoding, because I am serving static content.  
And by the way, is it a little bit harmful to use chunked transfer  
encoding on serving static content?

Thx a lot

Thx  
Jie

---

<div class="post-metadata">

**Author:** ![ZhangSTony](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/e99b99/32.png) [@ZhangSTony](https://www.ruby-forum.com/u/ZhangSTony)\
**Post date:** [June 4, 2009, 7:07pm UTC](https://www.ruby-forum.com/t/how-to-disable-chunked-transfer-encoding/169512/2 "2009-06-04T19:07:28Z")

</div>

Hello!

On Fri, Jun 05, 2009 at 12:23:54AM +0800, Zhang,Tony wrote:

> Hi
> 
> I found that Nginx set chunked transfer-encoding as default, so how can I disable this transfer-encoding, because I am serving static content. And by the way, is it a little bit harmful to use chunked transfer encoding on serving static content?

Support for chunked encoding is required for HTTP/1.1 clients,  
and nginx doesn’t use it for HTTP/1.0 clients (as required by RFC  
2616 too), so it should be safe.

But the question is - why chunked used in your case. It’s not  
used by nginx for static content with known length. Possible  
reasons include SSI processing truned on and/or gzip enabled  
(since resulting length of the response isn’t known while sending  
headers, and chunked transfer encoding is the only way to keep  
connections alive in this case).

Maxim D.

---

<div class="post-metadata">

**Author:** ![ZhangSTony](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/e99b99/32.png) [@ZhangSTony](https://www.ruby-forum.com/u/ZhangSTony)\
**Post date:** [June 4, 2009, 8:22pm UTC](https://www.ruby-forum.com/t/how-to-disable-chunked-transfer-encoding/169512/3 "2009-06-04T20:22:05Z")

</div>

Hi

Oh, gotcha , I did enable gzip

So, for instance, If I put a squid in front of Nginx which is gzip  
enabled, the chunked header will be disappeared, correct?

And my question is , will the chunked header do performance impact on  
static content serving, that’s my concern, and considering adding squid  
like things in front of Nginx?

Thx  
Jie

-----ÓÊ¼þÔ­¼þ-----  
·¢¼þÈË: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) [[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] ´ú±í Maxim  
Dounin  
·¢ËÍÊ±¼ä: 2009Äê6ÔÂ5ÈÕ 0:58  
ÊÕ¼þÈË: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Ö÷Ìâ: Re: How to disable chunked transfer-encoding

Hello!

On Fri, Jun 05, 2009 at 12:23:54AM +0800, Zhang,Tony wrote:

> Hi
> 
> I found that Nginx set chunked transfer-encoding as default, so how can I disable this transfer-encoding, because I am serving static content. And by the way, is it a little bit harmful to use chunked transfer encoding on serving static content?

Support for chunked encoding is required for HTTP/1.1 clients,  
and nginx doesn’t use it for HTTP/1.0 clients (as required by RFC  
2616 too), so it should be safe.

But the question is - why chunked used in your case. It’s not  
used by nginx for static content with known length. Possible  
reasons include SSI processing truned on and/or gzip enabled  
(since resulting length of the response isn’t known while sending  
headers, and chunked transfer encoding is the only way to keep  
connections alive in this case).

Maxim D.

No virus found in this incoming message.  
Checked by AVG - [www.avg.com](http://www.avg.com)  
Version: 8.5.339 / Virus Database: 270.12.53/2154 - Release Date:  
06/04/09 05:53:00

No virus found in this outgoing message.  
Checked by AVG - [www.avg.com](http://www.avg.com)  
Version: 8.5.339 / Virus Database: 270.12.53/2154 - Release Date:  
06/04/09 05:53:00

This e-mail is confidential. It may also be legally privileged.If you  
are not the addressee you may not copy, forward, disclose or use any  
part of it. If you have received this message in error,please delete it  
and all copies from your system and notify the sender immediately by  
return e-mail.Internet communications cannot be guaranteed to be  
timely,secure, error or virus-free. The sender does not accept liability  
for any errors or omissions.

---

<div class="post-metadata">

**Author:** ![ZhangSTony](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/e99b99/32.png) [@ZhangSTony](https://www.ruby-forum.com/u/ZhangSTony)\
**Post date:** [June 5, 2009, 6:25am UTC](https://www.ruby-forum.com/t/how-to-disable-chunked-transfer-encoding/169512/4 "2009-06-05T06:25:18Z")

</div>

Hi

Thank you very much

-----é‚®ä»¶åŽŸä»¶-----  
å‘ä»¶äºº: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) [[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] ä»£è¡¨ Maxim  
Dounin  
å‘é€æ—¶é—´: 2009å¹´6æœˆ5æ—¥ 2:49  
æ”¶ä»¶äºº: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
ä¸»é¢˜: Re: ç­”å¤: How to disable chunked transfer-encoding

Hello!

On Fri, Jun 05, 2009 at 02:11:11AM +0800, Zhang,Tony wrote:

> Hi
> 
> Oh, gotcha , I did enable gzip
> 
> So, for instance, If I put a squid in front of Nginx which is gzip enabled, the chunked header will be disappeared, correct?

As long as squid will behave like proxy (i.e. any uncached  
request) - no, it shouldn’t (as squid has to read full response  
before it will be able to drop chunked encoding).

> And my question is , will the chunked header do performance impact on static content serving, that’s my concern, and considering adding squid like things in front of Nginx?

No, shouldn’t have any noticeble performance impact, it’s just a  
few extra bytes. Adding squid in from of nginx will likely have  
though - I guess it will slow down things a lot.

If you really care about performance - take a look at gzip\_static  
module instead. This will save you a lot of CPU time. As a side  
effect it will allow nginx to use Content-Length instead of  
chunked, but this doesn’t really matter.

Maxim D.

> 2616 too), so it should be safe.
> 
> No virus found in this incoming message.  
> Checked by AVG - [www.avg.com](http://www.avg.com)  
> Version: 8.5.339 / Virus Database: 270.12.53/2154 - Release Date: 06/04/09 05:53:00
> 
> No virus found in this outgoing message.  
> Checked by AVG - [www.avg.com](http://www.avg.com)  
> Version: 8.5.339 / Virus Database: 270.12.53/2154 - Release Date: 06/04/09 05:53:00
> 
> This e-mail is confidential. It may also be legally privileged.If you are not the addressee you may not copy, forward, disclose or use any part of it. If you have received this message in error,please delete it and all copies from your system and notify the sender immediately by return e-mail.Internet communications cannot be guaranteed to be timely,secure, error or virus-free. The sender does not accept liability for any errors or omissions.

No virus found in this incoming message.  
Checked by AVG - [www.avg.com](http://www.avg.com)  
Version: 8.5.339 / Virus Database: 270.12.53/2155 - Release Date:  
06/04/09 17:55:00

No virus found in this outgoing message.  
Checked by AVG - [www.avg.com](http://www.avg.com)  
Version: 8.5.339 / Virus Database: 270.12.53/2155 - Release Date:  
06/04/09 17:55:00

This e-mail is confidential. It may also be legally privileged.If you  
are not the addressee you may not copy, forward, disclose or use any  
part of it. If you have received this message in error,please delete it  
and all copies from your system and notify the sender immediately by  
return e-mail.Internet communications cannot be guaranteed to be  
timely,secure, error or virus-free. The sender does not accept liability  
for any errors or omissions.

---

<div class="post-metadata">

**Author:** ![ZhangSTony](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/e99b99/32.png) [@ZhangSTony](https://www.ruby-forum.com/u/ZhangSTony)\
**Post date:** [June 4, 2009, 9:00pm UTC](https://www.ruby-forum.com/t/how-to-disable-chunked-transfer-encoding/169512/5 "2009-06-04T21:00:56Z")

</div>

Hello!

On Fri, Jun 05, 2009 at 02:11:11AM +0800, Zhang,Tony wrote:

> Hi
> 
> Oh, gotcha , I did enable gzip
> 
> So, for instance, If I put a squid in front of Nginx which is gzip enabled, the chunked header will be disappeared, correct?

As long as squid will behave like proxy (i.e. any uncached  
request) - no, it shouldn’t (as squid has to read full response  
before it will be able to drop chunked encoding).

> And my question is , will the chunked header do performance impact on static content serving, that’s my concern, and considering adding squid like things in front of Nginx?

No, shouldn’t have any noticeble performance impact, it’s just a  
few extra bytes. Adding squid in from of nginx will likely have  
though - I guess it will slow down things a lot.

If you really care about performance - take a look at gzip\_static  
module instead. This will save you a lot of CPU time. As a side  
effect it will allow nginx to use Content-Length instead of  
chunked, but this doesn’t really matter.

Maxim D.
