30

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.

5
  • You can't turn it off. You can only set the buffer size. Apr 7, 2016 at 4:59
  • @MichaelHampton but what about this explanation?
    – rad
    Apr 7, 2016 at 5:02
  • Ah, you're right. And you've answered your own question, it seems. Apr 7, 2016 at 5:37
  • @MichaelHampton well, yes, except it's still not turned off for some reason :(
    – rad
    Apr 7, 2016 at 13:05
  • 1
    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. Oct 6, 2016 at 19:56

2 Answers 2

34

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.

1

I use this area to disable proxy buffering

proxy_buffering                 off;
1
  • Thanks, that worked for me.
    – IpsRich
    Aug 15, 2022 at 11:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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