How to increase maximum HTTP header size for Java Spring Boot app hosted in Azure App Service (deployed as .WAR)?

Viewed 47

We have a Java Spring Boot application hosted in an Azure App Service (Windows), and we need to increase the value of maxHttpHeaderSize on the Tomcat 9 server to probably around 32KB. I can't work out how we can influence the server settings to do this.

How can I override the maxHttpHeaderSize value for the Tomcat server in the Azure App Service?

We have an application.yml file where we set various settings, but any server settings in there appear to get ignored by the App Service in Azure. For example, I can fix the issue locally by adding the option in application.yml, but when I deploy that it doesn't make any difference. I've also tried environment variables such as SERVER_MAX_HTTP_HEADER_SIZE, which again works locally but not on the deployed App Service.

Here are the "Stack settings" from the "Configuration" page for the App Service:

  • Stack: Java
  • Java version: Java 11
  • Java minor version: Java 11 (auto-update)
  • Java web server: Apache Tomcat 9.0
  • Java web server version: Apache Tomcat 9.0 (auto-update)

We currently deploy the app via a DevOps pipeline that uploads a .WAR.

The reason that we need to increase the maximum header size is that we integrate with Azure AD for authentication, and it's adding large headers (due to quite a large number of user groups we think) which are tipping requests over the current limit for some users.

Any guidance is much appreciated. Thank you!

1 Answers
Related