Forum Discussion
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.
Put additional log statements and see whether traffic is coming to your irule or not.
Monitor the logs. it will give some clue
when HTTP_REQUEST { log local0. "Client IP address is - [IP::client_addr]:[TCP::client_port]" if { ( [IP::addr [IP::client_addr] equals 10.10.10.0/24] ) } { log local0. "Client IP address is - [IP::client_addr]:[TCP::client_port]" HTTP::redirect "ttp://www.site1.com/ibs/Pages/ca_en.aspx" } elseif { ( [IP::addr [IP::client_addr] equals 10.10.11.0/24] ) } { log local0. "Client IP address is - [IP::client_addr]:[TCP::client_port]" HTTP::redirect "https://www.site2.com/scripts/index.aspx/bpg/travel/pages/Concur" } }
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com