Node/Nginx, 413 request entity too large, client_max_body_size set

天涯浪子 提交于 2019-12-11 09:39:20

问题


Pretty similar to 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.

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?


回答1:


Thanks to Xavier Lucas, problem was indeed with the app and not the nginx config, as suggested in this Github issue:

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

Resolved by setting json and urlencoded limits explicitly.




回答2:


I meet the same error, my node server use the koa-bodyparser, it limit the urlencoded body:

formLimit: limit of the urlencoded body. If the body ends up being larger than this limit, a 413 error code is returned. Default is 56kb.

It is nothing to do with nginx.



来源:https://stackoverflow.com/questions/27197856/node-nginx-413-request-entity-too-large-client-max-body-size-set

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!