Welcome! Log In Create A New Profile

Advanced

Blocking by user agent if ip doesn't match

Posted by karabaja 
Blocking by user agent if ip doesn't match
May 31, 2011 02:07PM
Hello everyone.
I am hoping this is possible and I'd really appreciate some help on configuring it.
We are having some bots on our site that are using google spider user agent but they are fake and their ip range has nothing to do with Google.
So I am looking for some solution that would match visitors with user agent is Google who's ip doesn't start with for example 66.x or 70.x and block them from accessing.

I've found this example on one site
if ($http_user_agent ~ (Purebot|Lipperhey|MaMa CaSpEr|libwww-perl|Mail.Ru|gold crawler) ) {
return 403;
}

But I don't know how to add ip regex match to that. Or negative match in this case I guess.



Edited 1 time(s). Last edit at 05/31/2011 02:08PM by karabaja.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 58
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready