How to block an IP that sends several requests

hello !

sorry i am new here.
my question: how to block an IP that sends several requests over a time interval?

I have a blacklist but you must first integrate the ip into my file, while I block the number of requests.

Thanks for your help

This article should guide you to the right direction: HAProxy Rate Limiting: Four Examples