Skip to main content
  1. How To/

Spring Boot Request Header too large

·145 words·1 min
Ravi Singh
Author
Ravi Singh
Software engineer with 15+ years building backend systems and cloud platforms across fintech, automotive, and academia. I write about the things I build, debug, and learn — so I don’t forget them.

How to solve IllegalArgumentException: Request header is too large in spring boot
#

When migrating a spring boot application to cloud, multiple layers got added to serve traffic.

  • On prem: nginx -> spring boot app (tomcat)
  • Azure: nginx -> azure application gateway -> nginx ingress controller -> spring boot app(tomcat)

In Azure, we noticed that some of http requests threw 400 http status code in our logs.

While investigating further, we found the reason IllegalArgumentException: Request header is too large

To solve the problem, we increased the header size from default 8KB to 12 KB via spring’s application property.

server:
  max-http-header-size: 12000

Not 100% sure, but our current hypothesis is that the size of request headers increased after using two additional layers in our architecture. Nevertheless, since the application works with increased header size, we never tried to investigate any further :

Links#


Discussion