cancel
Showing results for 
Search instead for 
Did you mean: 

SAP CAP Java - HTTPHeader size error

DC
Explorer
0 Kudos

Hi Experts,

We have a custom Action which processes an Arrays of requests and sends a response. We are using The Messages API for gathering success and error messages

For a complete successful payload (no errors found) we are get this in the logs. The sap-messages header is obviously too large 😞

Where do we update this setting when running in BAS and when on BTP Foundry???

org.apache.coyote.http11.HeadersTooLargeException: An attempt was made to write more 
data to the response headers than there was room available in the buffer. 
Increase maxHttpHeaderSize on the connector or write less data into the response headers.<br>

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

You can control the maximum HTTP header size by standard Spring configuration, e.g.

server.max-http-header-size: 16KB

to increase header size to 16KB (default is 8KB). Make sure that other components (e.g. AppRouter if existing) does also allow this adapted header size.

You should also consider to reduce amount of written data. Why are the messages that large in case of successful execution?

Answers (2)

Answers (2)

matthiaskuhr
Advisor
Advisor
0 Kudos

Please note that in case you are deploying your app as a WAR file you need to configure the tomcat container. Check this documentation in case you are using the SAP Java Buildpack with a WAR based deployment.

0 Kudos

Hi,

I assume your CAP Java application is running with spring-boot and an Apache Tomcat as web engine. In this case you can try to increase the maxHttpHeaderSize as it's suggested in the exception message. The default header size is about 8k, but you are trying to write more data into the response header. For this reason you get the exception.

I found this article about increasing this parameter: https://www.baeldung.com/spring-boot-max-http-header-size#overview-1

You can configure this parameter in the application.yaml of your CAP Java application.

Thanks,

Markus