当前位置:首页 > 编程笔记 > 正文
已解决

解决netty作为web,post请求体过大导致413 Request Entity Too Largew问题

来自网友在路上 162862提问 提问时间:2023-10-25 02:01:23阅读次数: 62

最佳答案 问答题库628位专家为你答疑解惑

问题

项目中使用netty作为web服务,postman请求体内容超出5mb请求netty时,返回413 Request Entity Too Large

解决

查询了一下资料:https://netty.io/4.0/api/io/netty/handler/codec/http/HttpObjectAggregator.html

  ChannelPipeline p = ...;...p.addLast("decoder", new HttpRequestDecoder());p.addLast("encoder", new HttpResponseEncoder());p.addLast("aggregator", new HttpObjectAggregator(1048576));...p.addLast("handler", new HttpRequestHandler());

修改HttpObjectAggregator的值 例如允许100MB那就是

  p.addLast("aggregator", new HttpObjectAggregator(100 * 1024 * 1024));
查看全文

99%的人还看了

猜你感兴趣

版权申明

本文"解决netty作为web,post请求体过大导致413 Request Entity Too Largew问题":http://eshow365.cn/6-23797-0.html 内容来自互联网,请自行判断内容的正确性。如有侵权请联系我们,立即删除!