Forum Discussion
Kmussa_164917
Nov 03, 2014Nimbostratus
Thanks to R Mac, I’m able to learn if the fourth octet is odd or even. However, I’m still not able to redirect based on this information.
when CLIENT_ACCEPTED { set fourthoctet [lindex [split [IP::client_addr] "."] 3] log local0. "CLIENT IP address [IP::client_addr]" log local0. "4th octect $fourthoctet" if { $fourthoctet%2} { log local0. "[IP::client_addr] is odd" } else { log local0. "[IP::client_addr] is even" } }
when HTTP_REQUEST { if { ( { $fourthoctet%2} ) and
( [active_members test01_pool] > 0 )} { HTTP::redirect http://test01.com[HTTP::uri] } elseif { ( { $fourthoctet%2} ) and
( [active_members test02_pool] > 0 )} { HTTP::redirect http://test02.com[HTTP::uri] } elseif { ( { $fourthoctet%2} ) and
( [active_members test02_pool] > 0 ) } { HTTP::redirect http://test02.com[HTTP::uri] } elseif { ( { $fourthoctet%2} ) and
( [active_members test01_pool] > 0)} { HTTP::redirect http://test01.com[HTTP::uri] } }