月关宝盒
如本博文所述,似乎可以使用mod_security来实现每秒的速率限制。配置是这样的:SecRuleEngine On<LocationMatch "^/somepath"> SecAction initcol:ip=%{REMOTE_ADDR},pass,nolog SecAction "phase:5,deprecatevar:ip.somepathcounter=1/1,pass,nolog" SecRule IP:SOMEPATHCOUNTER "@gt 60" "phase:2,pause:300,deny,status:509,setenv:RATELIMITED,skip:1,nolog" SecAction "phase:2,pass,setvar:ip.somepathcounter=+1,nolog" Header always set Retry-After "10" env=RATELIMITED</LocationMatch>ErrorDocument 509 "Rate Limit Exceeded"