maxPostSize determines how large the POST can be before Tomcat parses it “automatically”, whatever that means.
If you do this for security reasons, you need to think twice about how you do it. The DOS attack is not going to declare its size as the header of the HTTP request, it will simply send data until your server crashes.
You can check the Content-Length header of the request and immediately reject it if it is not submitted or too large, but you run the risk of abandoning genuine clients that do not supply a header that many will not.
Otherwise, you just need to read the request data until it crosses the threshold and then rejects it.
In any case, the container cannot help you.
source share