I would like to prevent any (or particular) requests larger than set size.
Example: 1GB POST request. Limit - 5MB. The upload starts and once it hits 5MB, the server immediately flushes the memory, withdraws the request and sends an error back.
Is there any good mechanism to do it?
Edit: I use multipart requests.
Duplicate: How to limit upload file size in express.js