21

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?

5 Answers 5

26

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.

2
  • 48000 is in bytes or kb?
    – Akash
    Oct 5, 2020 at 6:07
  • 2
    @Akash bytes. So, in this example, 48000 means 48KB.
    – sytech
    Oct 21, 2020 at 19:04
21

From Spring boot 2.1, you will now need to use a DataSize parsable value. e.g.

server.max-http-header-size=40KB
2
6

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.

2

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
1
0

The max-http-header-size property is deprecated since Spring Boot 3.

Now you can use max-http-request-header-size:

server:
    max-http-request-header-size: 12KB

Note: the value must be a DataSize, which is very clean. You can use 1KB instead of 1000. DataSize docs

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.