I'd like to protect two servers against attackers who blindly probe for urls.
my idea is to block requests after a certain amount of 404 status codes.
I could do this with fail2ban.
However one of the servers is behind a reverse proxy that I do not control and that does not communicate the originating IP address (and it will need a very long time before the request of forwarding the originating IP address will be handled), meaning that from nginx's point of few all requests originate from the revere proxy's IP and obviously I don't want to block all incoming traffic if somebody provokes too many 404s.
Is there any way (without fail2ban, with fail2ban or with any other tool) to detect at least 404 errors from the same https connection and to terminate this connection or to let it 404 unconditionally for any subsequent request?
Please tell me if my question is not clear and I'll try to rephrase it, to give more information.