a problem with chunked encoding

Maxim Dounin mdounin at mdounin.ru
Mon Oct 5 12:40:58 UTC 2015


On Sun, Oct 04, 2015 at 06:03:17AM -0400, esxgx wrote:

> I wrote a php script, for socks over http proxy, generating “chunked
> encoding” format, adding a header(Transfer-Encoding: chunked)
> and I first used apache, it works well.
> But when I used nginx/php-fpm, I found the response chunked encoding twice.
> I tried to turn off chunked encoding with "chunked_transfer_encoding off",
> but in the response header, there were no "Transfer-Encoding: chunked"
> that i added in the php script.

Don't encode FastCGI responses using chunked transfer encoding, 
this is not something nginx can tolerate.

Note well that it's believed to be violation of the following 
clause in RFC 3875 (http://tools.ietf.org/html/rfc3875#section-6.3.4):

:    The script MUST NOT return any header fields that relate to
:    client-side communication issues and could affect the server's
:    ability to send the response to the client.

When needed and possible, nginx will encode responses using 
chunked encoding itself.

Maxim Dounin

More information about the nginx mailing list