[How to Solve] java.lang.IllegalArgumentException: Request header is too large

background

Today, when I used springboot to develop my blog system, the following exception always appeared when I click Submit markdown file in the browser:

java.lang.IllegalArgumentException: Request header is too large

The web technology stack used is springboot, with Tomcat service embedded

Solution

After troubleshooting, it is because the server has a request length configuration. You can see from the source code of the server configuration class serverproperties that there are the following parameters:

/**
     * Maximum size, in bytes, of the HTTP message header.
     */
    private int maxHttpHeaderSize = 0; // bytes

There is a HTTP header maximum value setting, the unit is byte, as long as the application.properties The maximum value of file configuration is enough

#Request header length limit
server.max-http-header-size=10000000

Read More: