title: nginx proxy request buffering is not working as expected
body: <p>This is my nginx config :</p>
  
  <pre><code>worker_processes auto;
  user nginx;
  
  events {
      worker_connections 1024;
      use epoll;
  }
  
  http {
  
      tcp_nodelay               on;
      add_header Cache-Control  no-cache;
  
      upstream servers {
          server                127.0.0.1:9999;
          server                127.0.0.1:9998;
      }
  
      proxy_request_buffering   on;
  
   server {
     listen 80;
     client_max_body_size 200M;
     client_body_buffer_size 200M;
  
     server_name           localhost;
  
          location / {
              try_files    $uri @proxy_upload;
          }
  
          location @proxy_upload {
              proxy_pass_request_body on;
              proxy_pass              http://servers;
          }
  
   }
  }
  </code></pre>
  
  <p>I try to upload files, I am doing something like a chunked upload, files are more than 2G, client send files in chunks, the nginx and the script are working, but nginx is not working as expected</p>
  
  <p>you see, I turned proxy_request_buffering on, so I expect nginx buffer all 200M of file and then pass it to back-end(which is tornado-python) at once, but nginx pass it to back-end in 1M or 2M chunks, this behavior lead to very higher cpu usage, higher system load and lower upload speed, this behavior is not much different than setting proxy_request_buffering to off, so I think I am doing somehthing wrong here</p>
  
  <p>why is nginx not buffering correctly and how am I suppose to make nginx buffer the whole request and then pass it at once ?</p>
  
  <p>I tried to use post_action, but I couldn't pass request body to back-end</p>
  
  <p>UPDATE: Nginx is buffering correctly, I mean it pass request body to back-end as soon as whole file uploaded by client, but Nginx pass request body to back-end in smaller chunk and it won't pass it at once, It has whole body but it won't pass the whole body at once, How can I tell to nginx to pass request body to back-end at once ?</p>