本文共 1814 字,大约阅读时间需要 6 分钟。
java.lang.IllegalArgumentException: Request header is too large at org.apache.coyote.http11.Http11InputBuffer.fill(Http11InputBuffer.java:701) at org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:455) at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:667) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:798) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1434) at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:745)
配置 tomcat server xml
在tomcat的org.apache.coyote.http11.AbstractHttp11Protocol类中定义了其默认值:
/** * Maximum size of the HTTP message header. */ private int maxHttpHeaderSize = 8 * 1024;
所以,当请求头大于 8 * 1024,就会报错。针对这样的大数据量的请求,需要单独配置这个maxHttpHeaderSize的值。
在application.properties里面配置一下maxHttpHeaderSize的值:
server.max-http-header-size=1048576# Maximum number of connections that the server will accept and process at any given time.server.tomcat.max-connections= 3000# Maximum size in bytes of the HTTP post content.server.tomcat.max-http-post-size=1048576# Maximum amount of worker threads.server.tomcat.max-threads=1000
参考:
转载地址:http://lvqtx.baihongyu.com/