sniff122
sniff122

Reputation: 5

Nginx 413 HTTP error when uploading a file even with client_max_body_size set to above the file size

I am running nginx as a reverse proxy to a flask application and when attempting to upload a file, i get a 413 error from nginx (request entity too large).

I have added the client_max_body_size into the nginx configuration file and the configuration for the "redirect" to the flask application to no avail.

http {

        //NGINX configuration here//
        client_max_body_size 40M;
}

(site https listen)
http {

        //NGINX configuration here/
        client_max_body_size 40M;
}

The expected result is that the 413 error only occurs for files above the 40mb set limit but what does happen is nginx throws the 413 error for a 10mb test file

Upvotes: 0

Views: 1275

Answers (1)

kholisrag
kholisrag

Reputation: 373

you need put client_max_body_size at the top off server / location tag

Upvotes: 1

Related Questions