How to block fake google spider and fake web browser access?

Francis Daly francis at daoine.org
Wed May 6 18:46:34 UTC 2015


On Tue, May 05, 2015 at 07:05:59PM -0400, meteor8488 wrote:

Hi there,

> 		location / {
> 			root   /var/www;
> 
> 			if ( $geo = "badip" ) {
> 				return 444;
> 			}
> 			if ( $geo = "spider" ) {
> 				set $spiderip 1;
> 			}

http://wiki.nginx.org/IfIsEvil

You are using "if" inside "location" and doing something other than
"return".

That combination makes it too hard for me to understand what is happening.

I won't be surprised to learn that that combination is the reason your
"deny" directives do not act the way you want them to.

It looks to me like you can safely move all of these "if"s to server{}
level, outside the location{}.


If you do that, does it change the response that you get at all?

Cheers,

	f
-- 
Francis Daly        francis at daoine.org



More information about the nginx mailing list