Java – Spring Rest API maximum size HTTP POST


I currently have a Java Spring Rest API that enables images base64 to be uploaded to my server. Now I would like to know if there is a way I can limit the upload size so that people wont be able to upload 1GB and crash my server.

Best Solution

For those using Spring Boot, consider setting the following parameters in your (or application.yml) file:


See Common application properties.