I'm getting error 413 when uploading a 4MB file. I have already created a .user.ini
file on the public/
folder. to allow up to 10 MB files
So I used client_max_body_size
like this on my nginx.conf
, but I still get 413.
location / {
index index.php;
try_files $uri $uri/ /index.php?$query_string;
client_max_body_size 10M;
}
That configuration is because I'm using Laravel 5
.
This is my Procfile
web: vendor/bin/heroku-php-nginx -C nginx.conf public/
Did I do something wrong?
The solution is to increase the client request size body by the client_max_body_size parameter in nginx. conf file. Following is the description of the client_max_body_size parameter. The default value is 1MB and you can set this to an HTTP, server or location contexts.
Error: 413 “Request Entity Too Large” in Nginx with “client_max_body_size” / Changes in Nginx config file. This is happening because of your nginx server not allow to upload file which is larger than defined size in nginx config file.To solve it , you have to modify your nginx configuration.
Perhaps a bit late, but in order to fix this, move your client_max_body_size 10M;
outside of the location section. Like this:
client_max_body_size 10M;
location / {
index index.php;
try_files $uri $uri/ /index.php?$query_string;
}
See https://github.com/heroku/heroku-buildpack-php/blob/beta/conf/nginx/heroku.conf.php#L35 for reference on how heroku includes this file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With