《Springboot开发问题纪要》java.lang.IllegalArgumentException: Request header is too large

问题日志:java.lang.IllegalArgumentException: Request header is too large

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



《Springboot开发问题纪要》java.lang.IllegalArgumentException: Request header is too large_第1张图片
org.apache.coyote.http11.AbstractHttp11Protocol

原因分析:

在tomcat的org.apache.coyote.http11.AbstractHttp11Protocol类中定义了其默认值:

    /**
     * Maximum size of the HTTP message header.
     */
    private int maxHttpHeaderSize = 8 * 1024;

所以,当请求头大于 8 * 1024,就会报错。针对这样的大数据量的请求,需要单独配置这个maxHttpHeaderSize的值。

参考:
http://tomcat.apache.org/tomcat-8.0-doc/config/ajp.html

你可能感兴趣的:(《Springboot开发问题纪要》java.lang.IllegalArgumentException: Request header is too large)