Disabling proxy_buffering not working

Yuhao Zhang zzyzxd at gmail.com
Mon May 6 21:30:33 UTC 2019


Hi, Thank you for the explanation. I definitely need to learn more about the protocol spec. Would you help me understand why the "proxy_buffer_size" affects the result even when "proxy_buffering" is off?

Also, in my network topology, there are no other layer 7 hops. nginx is the only thing talks HTTP, and it is directly connecting to the backend server. I have also verified that, if I bypass nginx and directly connect to the TCP port, everything works just fine. So the chunks are not combined before they reach nginx.

Thanks,
Yuhao


________________________________
From: nginx <nginx-bounces at nginx.org> on behalf of Maxim Dounin <mdounin at mdounin.ru>
Sent: Monday, May 6, 2019 15:05
To: nginx at nginx.org
Subject: Re: Disabling proxy_buffering not working

Hello!

On Mon, May 06, 2019 at 07:08:44PM +0000, Yuhao Zhang wrote:

> I am facing this issue where proxied server's response is
> buffered before sending back to the request client, even when
> proxy_buffering is disabled.
>
> I also tried setting "X-Accel-Buffering: no" header on the
> response, but it didn't work.
>
> I posted the issue on ingress-nginx github repo, since It is
> what I am using on Kubernetes. However, now I think the root
> cause is in the underlying nginx. The ingress controller did its
> job correctly, which is configuring nginx.
>
> The full story and a reproducible example can be found here:
> https://github.com/kubernetes/ingress-nginx/issues/4063
>
> The nginx version used by the controller is 1.15.6

>From the issue description it looks like you think that proxying
with "proxy_buffering off;" should preserve HTTP transfer encoding
chunks as received from the upstream server. It's not, chunk
boundaries are not guaranteed to be preserved regardless of the
buffering settings. Chunked transfer encoding is a property of a
message as transferred between two HTTP entities, and can be
modified by any HTTP intermediary. You should not assume it will
be preserved. Quoting RFC 7230:

Unlike Content-Encoding (Section 3.1.2.1 of [RFC7231]),
Transfer-Encoding is a property of the message, not of the
representation, and any recipient along the request/response chain
MAY decode the received transfer coding(s) or apply additional
transfer coding(s) to the message body, assuming that corresponding
changes are made to the Transfer-Encoding field-value. Additional
information about the encoding parameters can be provided by other
header fields not defined by this specification.

The "proxy_bufferring off;" means that nginx won't wait for the
whole buffer to be filled before it will start sending the
response to the client. But as long as nginx have more than one
chunk received from the backend server, it will decode all the
chunks and will send them to the client combined.

--
Maxim Dounin
http://mdounin.ru/
_______________________________________________
nginx mailing list
nginx at nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20190506/19ce2c66/attachment.html>


More information about the nginx mailing list