Mapping a User Agent to an IP address:

Engin Akyol emakyol at gmail.com
Mon Feb 20 07:28:26 UTC 2012


Hey guys,

I'm running NGINX as a front for my apache servers and I'm having
issues where mappings within the config on occasion aren't being set.
For instance with the following config:

func $my_ip_match{
default 0;
1.1.1.1/32 1;
1.1.1.2/32 1;
1.1.1.3/32 1;
1.1.1.4/32 1;
}

#map the matches
map $name $match_value {
 default 0;
 ~*name_1 $my_ip_match;
 ~*name_2 $my_ip_match;
 ~*name_3 $my_ip_match;
 ~*name_4 $my_ip_match;
}

$my_ip_match will be set if the given IP/subnet is matched, but the
subsequent mapping is randomly executed.  I haven't been able to come
up with any reason why it ocassionally doesn't map.  Is there any
reason for this?

Thanks in advance!
/Engin



More information about the nginx mailing list