[Tfug] Apache blocking hosts based on multiple selectors?

Adrian choprboy at dakotacom.net
Fri Jul 13 14:33:01 MST 2018


Anyone played around with blocking bots on their web servers based on multiple 
attributes of the HTTP request? I already have various httpd.conf and 
.htaccess blocks on hosts based on UserAgent or IPs.

My server has been repeatedly hit recently by some garbage search bots using 
Google cloud services from vast IP ranges (downloading the same thing, 
multiple times per IP, from multiple IPs, within a few seconds of each other). 
I'd like to allow good behaving bots to continue search, but block the bad 
bots, using multiple attributes of the web request to decide if it is good 
request or not. I have not problem with a single selector, but combining 
Ifs/etc is just giving config errors on reload and I haven't spent enough time 
in the last several years to remember all the intricacies. Does anyone have an 
example <Directory> that blocks on a combination of UserAgent and netblock?


Adrian




More information about the tfug mailing list