I'm trying to set up Madsonic on my Ubuntu box and have Nginx run in front of it. Problem is, I keep getting this warning when I try to upload stuff through the web interface:

31115#0: *14 a client request body is buffered to a temporary file

This also explains why progress bars on the upload window doesn't work. Here's my relevant Nginx configuration:

    # proxy the madsonic server here
    location / {
            proxy_pass                      https://madsonic-server/;
            proxy_redirect                  off;
            proxy_buffering                 off;
            proxy_request_buffering         off;
            allow                           all;
            proxy_http_version              1.1;

            proxy_set_header                Host $http_host;
            proxy_set_header                X-Real-IP $remote_addr;
            proxy_set_header                X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header                X-Forwarded-Host $server_name;
            proxy_set_header                X-Forwarded-Proto $scheme;

            client_body_buffer_size         0;
            client_max_body_size            0;
            proxy_max_temp_file_size        0;
            proxy_read_timeout              18000;
            proxy_send_timeout              18000;

            gzip                            off;

I'm using Nginx 1.9.12 at the moment.

What I'd like to achieve is to make Nginx not use request body buffers at all and just pass the request body directly to Madsonic, regardless of size. Is this even possible? If it is, what would be the correct configuration?

Other questions seem to get answered with ways to set the buffer sizes. I don't want any buffers. I want to directly pass the request body to Madsonic.

  • You can't turn it off. You can only set the buffer size. – Michael Hampton Apr 7 '16 at 4:59
  • @MichaelHampton but what about this explanation? – rad Apr 7 '16 at 5:02
  • Ah, you're right. And you've answered your own question, it seems. – Michael Hampton Apr 7 '16 at 5:37
  • @MichaelHampton well, yes, except it's still not turned off for some reason :( – rad Apr 7 '16 at 13:05
  • Any luck with this? I'm having the same problem according to the docs setting proxy_request_buffering of will do the trick, but it still buffering uploads. – alejandrodnm Oct 6 '16 at 19:56

I had the same issue setting up an Nginx proxy for a Docker registry. I ended up doing:

client_max_body_size 0;
proxy_http_version 1.1;
proxy_request_buffering off;

client_max_body_size still had to be 0 to prevent the error, but watch -n 1 du -hs . clearly showed a difference. Buffering made the data appear after the request, no buffering made it appear during the request.

proxy_http_version 1.1 is necessary because of chunked encoding. Quote from the Nginx docs:

When HTTP/1.1 chunked transfer encoding is used to send the original request body, the request body will be buffered regardless of the directive value unless HTTP/1.1 is enabled for proxying.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.