Buffering issues with nginx
Francis Daly
francis at daoine.org
Wed Jul 19 20:15:51 UTC 2017
On Mon, Jul 17, 2017 at 09:47:39PM -0400, Dan34 wrote:
Hi there,
> > Are you concerned about the request or the response being buffered?
>
> my problem is that response that my node app (upstream server) generates is
> buffered by nginx.
So you want proxy_buffering (http://nginx.org/r/proxy_buffering) set to
"off" in the location that does the proxy_pass.
> My actual goal is to know speed and amount of data that my node app sent to
> a client.
It may be the case that that is not knowable, in general, in a single
http request.
Depending on the compromises you are willing to make, to accuracy or
convenience, you may be able to come up with something good enough.
> So, when I sent 20MB binary blob from node I can wait till data is
> sent out and I'll know approximate speed and size. The moment I put my node
> app behind an nginx proxy things fall apart: suddenly all transfers are
> instant, and I cannot even know if entire 20MB of data was delivered or if
> the connection failed in the middle.
Yes. That is (part of) what a proxy does. Even without nginx as a
reverse-proxy, your client might be talking through one or more proxy
servers. You will never know whether your response got to the actual
end client, without some extra verification step that only the end
client does.
> When I updated some of these buffering
> configs things improved, but still were failing with smaller uploads that
> are still fully buffered by nginx.
proxy_buffers and proxy_buffer_size can be tuned (lowered, in this case,
probably) to slow down nginx's receive-rate from your upstream.
If you can show one working configuration with a description of how
it does not do what you want it to do, possibly someone can offer some
advice on what to change.
Good luck with it,
f
--
Francis Daly francis at daoine.org
More information about the nginx
mailing list