I have Spring boot app running Java 11:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
And I am getting the error: java.lang.IllegalArgumentException: Request header is too large
How to increase max-http-header-size
?
The HTTP header values are restricted by server implementations. In a Spring Boot application, the max HTTP header size is configured using server. max-http-header-size. The actual default value for Tomcat and Jetty is 8kB, and the default value for Undertow is 1MB.
No, HTTP does not define any limit. However most web servers do limit size of headers they accept. For example in Apache default limit is 8KB, in IIS it's 16K. Server will return 413 Entity Too Large error if headers size exceeds that limit.
The default HTTP Request Header value is 8190 bytes.
You should set on the "application.properties" file:
server.max-http-header-size=48000
48000 is an example of an excessive header, put whatever you want.
From Spring boot 2.1, you will now need to use a DataSize
parsable value. e.g.
server.max-http-header-size=40KB
Please try server.max-http-header-size
. I have found it here: Common application properties.
The default value for Tomcat and Jetty is 8KB and for Undertow is 1MB.
In spring boot 1.3.5.RELEASE what worked for me is setting the following entry in application.properties:
server.tomcat.max-http-header-size=100000
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With