Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase request entity limitation in nginx #356

Closed
Remo opened this issue Aug 16, 2018 · 10 comments · Fixed by #520
Closed

Increase request entity limitation in nginx #356

Remo opened this issue Aug 16, 2018 · 10 comments · Fixed by #520

Comments

@Remo
Copy link
Contributor

Remo commented Aug 16, 2018

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 ;-)

@cytopia cytopia self-assigned this Aug 17, 2018
@cytopia
Copy link
Owner

cytopia commented Aug 17, 2018

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

Valid

@cytopia
Copy link
Owner

cytopia commented Aug 18, 2018

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.

@Remo
Copy link
Contributor Author

Remo commented Aug 20, 2018

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.

@vikas5914
Copy link
Contributor

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

@science695
Copy link

science695 commented Nov 26, 2018

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.

@vikas5914
Copy link
Contributor

@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.

@science695
Copy link

science695 commented Nov 26, 2018

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;

@cytopia
Copy link
Owner

cytopia commented Jan 5, 2019

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.

@cytopia
Copy link
Owner

cytopia commented Mar 3, 2019

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

@cytopia
Copy link
Owner

cytopia commented Mar 3, 2019

Devilbox PR

I've create a PR: #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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants