How to disable chunked transfer-encoding


#1

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


#2

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.


#3

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] ´ú±í Maxim
Dounin
·¢ËÍʱ¼ä: 2009Äê6ÔÂ5ÈÕ 0:58
ÊÕ¼þÈË: 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
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
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.


#4

Hi

Thank you very much

-----邮件原件-----
发件人: removed_email_address@domain.invalid [mailto:removed_email_address@domain.invalid] 代表 Maxim
Dounin
发送时间: 2009年6月5日 2:49
收件人: 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
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
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
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
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.


#5

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.