Dev01
Dev01

Reputation: 14159

dokku: 413 Request Entity Too Large

I keep getting the "413 Request Entity Too Large" error when uploading files that are larger than 1M. I followed the following instructions from here but it didn't work.

mkdir /home/dokku/myapp/nginx.conf.d/
echo 'client_max_body_size 50M;' > /home/dokku/myapp/nginx.conf.d/upload.conf
chown dokku:dokku /home/dokku/myapp/nginx.conf.d/upload.conf
service nginx reload

I tried updating my Procfile adding a php.ini file to my root directory with the following entry but it also didn't help:

Procfile:

web: vendor/bin/heroku-php-nginx -C nginx.conf -i php.ini php/

php.ini:

upload_max_filesize = 100M
post_max_size = 100M

What am I doing wrong? Is there anyway to test if my configurations are being used or if they are being overwritten by something else? I checked phpinfo(); and those setting are being used, is there an equivalent to that for nginx?

Is there a way to change the nginx settings globally for all images?

Upvotes: 6

Views: 2324

Answers (2)

小坂井拳吾
小坂井拳吾

Reputation: 1

I'm using dokku version 0.34.3, and now the answer frmdstryr posted is no longer valid. The current version dokku can be configured like this:

dokku nginx:set your-app client-max-body-size 50m

This enabled my rails app to work with carrierwave upload and so on.

Upvotes: 0

frmdstryr
frmdstryr

Reputation: 21362

Dokku's default nginx config limits the client max body size to to 1MB.

You can reconfigure this by:

mkdir /home/dokku/node-js-app/nginx.conf.d/
echo 'client_max_body_size 50m;' > /home/dokku/node-js-app/nginx.conf.d/upload.conf
chown dokku:dokku /home/dokku/node-js-app/nginx.conf.d/upload.conf
service nginx reload

Where node-js-app is the app name. See http://dokku.viewdocs.io/dokku/configuration/nginx/#customizing-via-configuration-files-included-by-the-default-tem

Upvotes: 15

Related Questions