Forum Discussion

Diego_23471's avatar
Diego_23471
Icon for Nimbostratus rankNimbostratus
Apr 23, 2013

redirect based on source ip

I can't seem to get redirects based on client IP working. The IP on alloweed IP class works by passing traffic. All other ips get dropped.

 

 

when CLIENT_ACCEPTED {

 

 

Check if client IP is in the datagroup

 

if {[matchclass IP:addr[IP::client_addr] equals $::ALLOWED_IP_class]}{

 

pool prodpool

 

} else {

 

pool testpool

 

}

 

}

 

1 Reply

  • IP::addr is a boolean operator, which you don't need to make a comparison with a data group entry. So an updated (v10/v11) version of your rule might look something like this:

    
    when CLIENT_ACCEPTED {
         if { [class match [IP::client_addr] equals ALLOWED_IP_class] } {
              pool prodpool
         } else {
              pool testpool
         }
    }
    

    If you define ALLOWED_IP_class as an address class, then you can filter on both host (specific) and network (subnet) client IPs.