Spring Boot出现 java.lang.IllegalArgumentException. Request header is too large 解决方法

问题分析:

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

java.lang.IllegalArgumentException: Request header is too large
	at org.apache.coyote.http11.Http11InputBuffer.fill(Http11InputBuffer.java:766) ~[tomcat-embed-core-9.0.37.jar!/:9.0.37]
	at org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:452) ~[tomcat-embed-core-9.0.37.jar!/:9.0.37]
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:260) ~[tomcat-embed-core-9.0.37.jar!/:9.0.37]
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) [tomcat-embed-core-9.0.37.jar!/:9.0.37]
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868) [tomcat-embed-core-9.0.37.jar!/:9.0.37]
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1589) [tomcat-embed-core-9.0.37.jar!/:9.0.37]
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-9.0.37.jar!/:9.0.37]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_261]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_261]
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-9.0.37.jar!/:9.0.37]
	at java.lang.Thread.run(Thread.java:748) [na:1.8.0_261]

如果是spring boot项目(注意各个版本可能稍有不同):
在application.yaml

##tomcat 请求设置
server:
  tomcat:
    max-http-form-post-size: 50MB
    threads:
      max: 1000
    max-connections: 6000

猜你喜欢

转载自blog.csdn.net/weixin_43088443/article/details/112971050
今日推荐