Devilbox: Increase request entity limitation in nginx

Created on 16 Aug 2018  路  10Comments  路  Source: cytopia/devilbox

ISSUE TYPE

  • Feature request

SUMMARY

I frequently get 413 Request Entity Too Large when I'm trying to upload some files. The files aren't even that big, here's an example:

image

Goal

It's an environment for development, can't imagine it would hurt to have a very generous limit. If I want to kill my own server so be it ;-)

config-change nginx

Most helpful comment

Would it be a problem to change that for everyone? I assume no body is using devilbox in production, having generous limits in a dev might reduce support requests? I'm fine with that change, it's not a big deal.

All 10 comments

If I want to kill my own server so be it ;-)

Valid

As far as I have tried, you will only need to change the nginx configuration and add the following value:

client_max_body_size 100M;

How to adjust nginx.conf globally on the Devilbox is described here: https://devilbox.readthedocs.io/en/latest/configuration-files/nginx-conf.html

Let me know if this fixes your issue, so I can add this to the docs as a common issue.

Would it be a problem to change that for everyone? I assume no body is using devilbox in production, having generous limits in a dev might reduce support requests? I'm fine with that change, it's not a big deal.

I am with @Remo. We should increase it to 100M for everyone.

However, there are some people who are trying to use this in production, or at least moving towards that direction.

And I would advise against your development environment having higher limits than your production environment. Things might work in develoment and suddenly break when they go down the pipeline (hopefully in testing / qa rather than production but ....)

Perhaps this size limit should be more prominently displayed in the documentation (maybe a footnote in the setup?)

I'm not sure what the default value is, but perhaps a more reasonable default could be set with instructions on how to raise it for yourself.

@science695 I agree with you but even in production, I set the "client_max_body_size " value higher than 8MB.

How about setting it to a normal default value like 20-25 MB.

20-25MB sounds very reasonable.

640K [memory] ought to be enough for anyone.
https://quoteinvestigator.com/2011/09/08/640k-enough/

So, to state this explicitly:

Can the default config file for nginx include:

client_max_body_size 25M;

Keep in mind that by setting a default of client_max_body_size 25M; this value cannot be changed afterwards anymore via the current file-based configuration method.

It can then only be overwritten on a per vhost base, but not in cfg/nginx-/*.conf as nginx does not allow duplicate statements. This method is more complicated and requires a template to be added to each project: https://devilbox.readthedocs.io/en/latest/vhost-gen/virtual-host-templates.html

Also to be in sync with Apache, the current default settings are 0, meaning unlimited: https://httpd.apache.org/docs/2.4/mod/core.html#limitrequestbody

Nginx also seems to allow for unlimited size: http://nginx.org/en/docs/http/ngx_http_core_module.html#client_max_body_size

Once again, tradeoff will be, if it is set as a default, its more difficult to change it afterwards. And having a value of 25M in place might work for a couple of people, but other might require even more, or wanna test the site with a smaller value to duplicate production settings.

New HTTPD images

@Remo @vikas5914 @science695 @serge22

For Nginx, I have now set worker_processes to auto and client_max_body_size to 0 to be in line with Apache 2.(2|4)

Additionally the nginx.conf is now a separate file for easier configuration and the Via header has been added showing: <HTTP_PROTOCOL> <HOSTNAME> (<SERVER_NAME>/<SERVER_VERSION>) to be in sync with Varnish and HAProxy

Devilbox PR

I've create a PR: https://github.com/cytopia/devilbox/pull/520

Please try out and report back if it works as expected.

docker-compose stop
docker-compose rm

git checkout nginx-request-entity-limitations

docker-compose up
Was this page helpful?
0 / 5 - 0 ratings

Related issues

hurrtz picture hurrtz  路  5Comments

drupalshift picture drupalshift  路  5Comments

cytopia picture cytopia  路  4Comments

zack6849 picture zack6849  路  5Comments

Novitsh picture Novitsh  路  6Comments