Forum Discussion
Oct 17, 2015
It's to check if the IP is even or odd. If it's 172.16.4.15 it will be 15 % 2, which is 1. If it's 172.16.4.14 it will be 14 % 2, which is 0.
when HTTP_REQUEST {
Get the last octet. For 172.16.4.11 that would be 11
set lastoctet [lindex [split [IP::client_addr] .] 3]
Check if the octet is odd or even with modulus (remainder)
if { [expr $lastoctet % 2] == 1 } {
HTTP::respond 301 Location "http://mysite1.com"
} else {
HTTP::respond 301 Location "http://mysite2.com"
}
}
/Patrik