问题原因
一个新增的接口,因为前端传入一段很长的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 =