'.htaccess rule to drop the connection without any response

I'm trying to set up an .htaccess rule, that, upon a certain file being requested off the server, will completely drop the connection if the rewrite condition is met.

I don't wanna just deny the connection and send any HTTP status code in response - I want to set it up in such a way that the connection will simply be dropped with no response whatsoever when the condition is met. No 403s, no redirects, nothing. Pretty much as if the request is blocked by a firewall.

How would I go about doing that, and is it doable with .htaccess?



Solution 1:[1]

You may do so, after one status (you may manipulate its number) provided to the client, and then use fail2ban with a jail for a long period having blockaction being set to drop. Fail2ban would add the blocked ip to the firewall iptable.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ziegel