disable request buffering in nginx

Uriel Katz picture Uriel Katz · May 11, 2011 · Viewed 18.4k times · Source

It seems that nginx buffers requests before passing it to the updstream server,while it is OK for most cases for me it is very bad :)

My case is like this:

I have nginx as a frontend server to proxy 3 different servers:

  1. apache with a typical php app
  2. shaveet(a open source comet server) built by me with python and gevent
  3. a file upload server built again with gevent that proxies the uploads to rackspace cloudfiles while accepting the upload from the client.

#3 is the problem, right now what I have is that nginx buffers all the request and then sends that to the file upload server which in turn sends it to cloudfiles instead of sending each chunk as it gets it (those making the upload faster as i can push 6-7MB/s to cloudfiles).

The reason I use nginx is to have 3 different domains with one IP if I can't do that I will have to move the fileupload server to another machine.

Answer

vanthome picture vanthome · Jan 20, 2015

As soon as this [1] feature is implemented, Nginx is able to act as reverse proxy without buffering for uploads (bug client requests). It should land in 1.7 which is the current mainline.

[1] http://trac.nginx.org/nginx/ticket/251

Update

This feature is available since 1.7.11 via the flag

proxy_request_buffering on | off;

http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_request_buffering