简体   繁体   English

Node / Nginx,413个请求实体太大,设置了client_max_body_size

[英]Node/Nginx, 413 request entity too large, client_max_body_size set

Pretty similar to https://serverfault.com/questions/539466/413-request-entity-too-large-client-max-body-size-is-set 非常类似于https://serverfault.com/questions/539466/413-request-entity-too-large-client-max-body-size-is-set

I've got a Node server (using Loopback) running on top of nginx (to be specific, the dockerfile/nginx image), but whenever I do a large PUT (or POST) request to the Node server, I get back a 413 response. 我已经在nginx(具体来说,dockerfile / nginx映像)上运行了一个节点服务器(使用回送),但是每当我对节点服务器执行大的PUT(或POST)请求时,我都会得到一个413响应。

I've set client_max_body_size (for me, in /etc/nginx/nginx.conf) in a number of places and to exorbitant values and yet still get the 413s... is there something I'm missing? 我已经在许多地方设置了client_max_body_size(对我来说,在/etc/nginx/nginx.conf中),并设置了高估的值,但仍然得到413s ...我缺少什么吗?

Thanks to Xavier Lucas, problem was indeed with the app and not the nginx config, as suggested in this Github issue: 感谢Xavier Lucas,问题确实出在应用程序而不是nginx配置上,这是在此Github问题中建议的:

https://github.com/strongloop/loopback/issues/690 https://github.com/strongloop/loopback/issues/690

Resolved by setting json and urlencoded limits explicitly. 通过显式设置json和urlencoded限制来解决。

I meet the same error, my node server use the koa-bodyparser , it limit the urlencoded body: 我遇到同样的错误,我的节点服务器使用koa-bodyparser ,它限制了urlencoded主体:

formLimit: limit of the urlencoded body. formLimit:urlencode主体的限制。 If the body ends up being larger than this limit, a 413 error code is returned. 如果主体最终大于此限制,则返回413错误代码。 Default is 56kb. 默认值为56kb。

It is nothing to do with nginx. 与nginx无关。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM