The best way to stop excesive post's to your server is to install fail2ban and configure it to read your access log(s) to ban ip's that post more than x times in a range of x seconds (so for example ban ip's that post more than 4 times in 3 minutes).
What failban does is, it reads your logs, and based on the regex from its filters it can ban ip's.
Not going to post how to install it (tons of tutorials around), but will provide the post filer and configuration you require below:
Post Filter File. In my exmple it is named post-ban.conf and placed in the filter.d folder:
[Definition]
failregex = ^<HOST> -.*"POST .*".*$
ignoreregex =
jail.local config (in the root folder of fail2ban) you can just add this to the array of existing filters
[post-ban]
enabled = true
port = http,https
filter = post-ban
logpath = %(nginx_access_log)s
maxretry = 4
findtime = 180
bantime = 60000
The config here is set to ban the ip for 60000 seconds on the 4th post within 180 seconds. You will have to change the logpath if you are not running nginx