11

This should be a quick fix. So for some reason I still can't get a request that is greater than 1MB to succeed without returning 413 Request Entity Too Large.

For example with the following configuration file and a request of size ~2MB, I get the following error message in my nginx error.log:

*1 client intended to send too large body: 2666685 bytes,

I have tried setting the configuration that is set below and then restarting my nginx server but I still get the 413 error. Is there anything I am doing wrong?

server {
    listen      8080;
    server_name *****/api; (*omitted*)

    client_body_in_file_only clean;
    client_body_buffer_size 32K;
    charset     utf-8;
    client_max_body_size 500M;
    sendfile on;
    send_timeout 300s;
    listen 443 ssl;
    location / {
        try_files $uri @(*omitted*);
    }
    location @parachute_server {
        include uwsgi_params;
        uwsgi_pass    unix:/var/www/(*omitted*)/(*omitted*).sock;
    }
  }

Thank you in advance for the help!

dirn
  • 19,454
  • 5
  • 69
  • 74
Daniel Gaeta
  • 774
  • 2
  • 9
  • 22
  • Does this answer your question? [nginx - client\_max\_body\_size has no effect](https://stackoverflow.com/questions/2056124/nginx-client-max-body-size-has-no-effect) – cgl Mar 19 '21 at 10:20

3 Answers3

4

I'm surprised you haven't received a response but my hunch is you already have it set somewhere else in another config file.

Take a look at nginx - client_max_body_size has no effect

Community
  • 1
  • 1
CYMA
  • 621
  • 7
  • 15
1

Weirdly it works after adding the same thing "client_max_body_size 100M"in http,location,server all the blocks.

0

I had the same problem. I entered "client_max_body_size" in nginx.conf under the "server" and I was still getting the 413 error. But after I added the same line under the "http" it solved my problem.

starball
  • 20,030
  • 7
  • 43
  • 238
Dzoni
  • 31
  • 7