0

Problem I want to restrict the file sizes uploaded to my application server. But entity to large message comes after uploading completed.
For example my nginx config is like the following
http { client_max_body_size 6M;} When the request is greater than 6MB,I expect http 413 status code, but
I am trying to uploading a 2 GB file. after the upload is fully(2GB) completed,the gives a message '413 entity to large'.
In addition also as soon as the request came nginx, writed a message to error.log file like below
client intended to send too large body: 2031304213 bytes
but client http response comes after the file is fully loaded.

What is my fault ? Thanks

hbergun
  • 1
  • 1
  • you can add validation in client side as well before sending data to server https://stackoverflow.com/questions/3717793/javascript-file-upload-size-validation – Ramratan Gupta Mar 05 '20 at 07:49

1 Answers1

0

Can you try adding the limit inside server section?

server {
    client_max_body_size 20M;
Naveen Hiremath
  • 351
  • 1
  • 8