I have a Spring Boot application with a POST API endpoint that processes large payloads. By default, I understand that Spring Boot (with embedded Tomcat) sets the maximum HTTP POST request size to 2MB using the property server.tomcat.max-http-post-size=2MB.
However, when I test my API with payloads larger than 2MB, such as 50MB, the API processes these requests without throwing any errors. I need to restrict the payload size to a maximum of 1MB or 2MB to prevent processing very large requests.I am using spring boot version 3.0.5
Here are my current configurations in application.properties:
server.tomcat.max-http-post-size=2MB
Issues:
Why am I able to process large payloads despite setting server.tomcat.max-http-post-size=2MB?
How can I ensure that my Spring Boot application throws an error when the payload exceeds 1MB or 2MB?