Score:0

Nginx: Disabling request body buffering for a dockerized project

er flag

I have Nginx 1.18 (not dockerized) to host a REST API application (running in a Docker Container) on Ubuntu 20.04, and I try to set proxy_request_buffering off to allow uploading large files with streaming. Here it is my server blocks:

server {
   server_name mydomain;
   location ~ ^/(api|static\-data|static\-files)/ {
     proxy_pass         http://127.0.0.1:5001;
     proxy_http_version 1.1;
     proxy_set_header   Upgrade $http_upgrade;
     proxy_set_header   Connection keep-alive;
     proxy_set_header   Host $host;
     proxy_cache_bypass $http_upgrade;
     proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
     proxy_set_header   X-Forwarded-Proto $scheme;
     proxy_connect_timeout       300;
     proxy_send_timeout          300;
     proxy_read_timeout          300;
     send_timeout                300;
     proxy_request_buffering off;
     client_max_body_size 1000m;
     client_body_buffer_size 1000m;
   }
}

But it does not work for me.

Beside upload API, I have another API to show the progress. When upload API is in pending state, the response of the progress API reveals that my application does not receive the upload request until the file is fully buffered by Nginx. So my back-end application receives files completely, and in the client side, the progress bar displays zero percent until the entire file is uploaded.

By the way, anything is OK when I test locally with Kestrel. Any ideas?

djdomi avatar
za flag
what means does nor work entirely. thats not an exact description what happened and what the server is telling for an error
Mohamad Mehdi Rajaei avatar
er flag
Thank you @djdomi. I edited the question.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.