前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Request header is too large 的问题解决

Request header is too large 的问题解决

作者头像
tongyao
发布2022-06-09 15:13:27
1.8K0
发布2022-06-09 15:13:27
举报
文章被收录于专栏:tongyao

问题原因

一个新增的接口,因为前端传入一段很长的JSON数组,导致了打印台报错

错误描述

java.lang.IllegalArgumentException: Request header is too large

解决方案

查阅了一下资料得到了一个答案

请求头超过了tomcat的限值。本来post请求是没有参数大小限制,但是服务器有自己的默认大小。

那就修改服务器的大小

普通tomcat

在server.xml中

代码语言:javascript
复制
 <Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443" maxPostSize="0" maxHttpHeaderSize ="102400"/>

处加上maxHttpHeaderSize =”102400”

SpringBoot

SpringBoot项目更方便了,在 application.properties 文件中添加

代码语言:javascript
复制
server.max-http-header-size=102400

其他

SpringBoot内置Tomcat的所有配置选项如下:

代码语言:javascript
复制
server. Port = xxxx

server. Address =

server. contextPath =

server. displayName =

server. servletPath =

server. contextParameters =

server. useForwardHeaders =

server. serverHeader =

server. maxHttpHeaderSize =

server. maxHttpPostSize =

server. connectionTimeout =

server. session.timeout =

server. session.trackingModes =

server. session.persistent =

server.session.storeDir =

server.cookie. name =

server.cookie. domain =

server.cookie. path =

server.cookie. comment =

server.cookie. httpOnly =

server.cookie. secure =

server.cookie. maxAge =

server. ssl. Enabled =

server.ssl. clientAuth =

server.ssl. ciphers =

server.ssl. enabledProtocols =

server.ssl. keyAlias =

server.ssl. keyPassword =

server.ssl. keyStore =

server.ssl. keyStorePassword =

server.ssl. keyStoreType =

server.ssl. keyStoreProvider =

server.ssl. trustStore =

server.ssl. trustStorePassword =

server.ssl. trustStoreType =

server.ssl. trustStoreProvider =

server.ssl. protocol =

server.compression. enabled =

server.compression.mimeTypes =

server.compression.excludedUserAgents =

server.compression.minResponseSize =

server. jspServlet. className =

server.jspServlet. initParameters =

server.jspServlet.registered =

server.tomcat.accesslog.enabled =

server.tomcat.accesslog.pattern =

server.tomcat.accesslog.directory =

server.tomcat.accesslog.prefix =

server.tomcat.accesslog.suffix =

server.tomcat.accesslog.rotate =

server.tomcat.accesslog.renameOnRotate =

server.tomcat.accesslog.requestAttributesEnabled=

server.tomcat.accesslog.buffered =

server.tomcat.internalProxies =

server.tomcat.protocolHeader =

server.tomcat.protocolHeaderHttpsValue =

server.tomcat.portHeader =

server.tomcat.remoteIpHeader=

server.tomcat.basedir =

server.tomcat.backgroundProcessorDelay =

server.tomcat.maxThreads =

server.tomcat.minSpareThreads =

server.tomcat.maxHttpPostSize =

server.tomcat.maxHttpHeaderSize =

server.tomcat.redirectContextRoot =

server.tomcat.uriEncoding =

server.tomcat.maxConnections =

server.tomcat.acceptCount =

server.tomcat.additionalTldSkipPatterns =
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2021年12月20日,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 问题原因
  • 错误描述
  • 解决方案
  • 普通tomcat
  • SpringBoot
  • 其他
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档