Greg_Hammond
Aug 27, 2020Nimbostratus
url redirect based on client IP address range
I have written the following irule to redirect http requests based on IP address ranges but the user says it isn't working. Just need a little help verifying that the syntax is correct or if I am missing anything.
when HTTP_REQUEST {
if { [IP::addr [IP::client_addr] equals 10.10.10.0/24] }{ HTTP::redirect "http://www.site1.com/ibs/Pages/ca_en.aspx" }
elseif { [IP::addr [IP::client_addr] equals 10.10.11.0/24] }{ HTTP::redirect "https://www.site2.com/scripts/index.aspx/bpg/travel/pages/Concur" }
}
There are only 2 ranges that need to be redirected. If an IP is not in either of these ranges, it should just fail which is why there is no "drop out" rule.
Thanks in advance.