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.
|
|
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 :