a problem with chunked encoding

esxgx nginx-forum at nginx.us
Wed Oct 7 12:29:22 UTC 2015

Maxim Dounin, 

Thanks for your prompt reply~ ^ ^
Actually In my script, the tcp stream is encrypted and disguised as a normal
chunked downloaded file to pass the firewall, and I need to control every
chunk(the stream is encrypted in blocks, and a chunk represents a block) so
that there is no specific protocol identification.

If the script cannot control the process of chunked encoding, it should have
some identification so that the firewall can update itself to find out the
proxy stream.

There are many web hostings that use nginx + php-fpm, so I wrote the script
in PHP.

Does that mean I cannot use nginx as a web server in this way?

Nginx is an excellent web server with good proformance, I'm not willing to
give up this server.


Maxim Dounin Wrote:
> Hello!
> 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
> http://nginx.org/
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,261998,262046#msg-262046

More information about the nginx mailing list