客户端提交数据的时候出现如下错误:
request entity too large
413
Error: request entity too large at readStream (F:\mypro\test\node_modules\body-parser\node_modules\raw-body\index.js:196:17) at getRawBody (F:\mypro\test\node_modules\body-parser\node_modules\raw-body\index.js:106:12) at read (F:\mypro\test\node_modules\body-parser\lib\read.js:76:3) at urlencodedParser (F:\mypro\test\node_modules\body-parser\lib\types\urlencoded.js:115:5) at Layer.handle [as handle_request] (F:\mypro\test\node_modules\express\lib\router\layer.js:95:5) at trim_prefix (F:\mypro\test\node_modules\express\lib\router\index.js:312:13) at F:\mypro\test\node_modules\express\lib\router\index.js:280:7 at Function.process_params (F:\mypro\test\node_modules\express\lib\router\index.js:330:12) at next (F:\mypro\test\node_modules\express\lib\router\index.js:271:10) at jsonParser (F:\mypro\test\node_modules\body-parser\lib\types\json.js:112:7) at Layer.handle [as handle_request] (F:\mypro\test\node_modules\express\lib\router\layer.js:95:5) at trim_prefix (F:\mypro\test\node_modules\express\lib\router\index.js:312:13) at F:\mypro\test\node_modules\express\lib\router\index.js:280:7 at Function.process_params (F:\mypro\test\node_modules\express\lib\router\index.js:330:12) at next (F:\mypro\test\node_modules\express\lib\router\index.js:271:10) at logger (F:\mypro\test\node_modules\morgan\index.js:144:5)
使用网上的方法修改bodyparse的limit,没有效果 app.use(bodyParser.json({limit: ‘50mb’})); app.use(bodyParser.urlencoded({limit: ‘50mb’, extended: true}));
这个怎么解决啊
你到底传的是什么数据啊?大致描述一下
估计是你传的数据太大了,比如说上传文件什么的,可以修改服务器的一些配置,调整最大上传大小
app.use(bodyParser.urlencoded({limit: ‘50mb’, extended: true})); 我是这样设置的,limit自己取
来自酷炫的 CNodeMD
ddddd
sfsdfdssdffsdfssdf
关注下,目前没遇到过。过大的考虑断点续传
就是一大串字符串,我算了一下,不到100k的样子,应该不算大吧
刚巧解决了这个问题 在你的node_modules/express-http-proxy/index.js 里面有一行 var limit = options.limit || ‘1mb’; 改大一点 var limit = options.limit || ‘10mb’;
本人菜鸟只是随便用用 就直接改代码了