Forum Discussion
IDEXX_174255
Nimbostratus
Oct 16, 2014issue with iRule - client IP and http redirect
Can someone help me fix my error? I'm trying to add to a Big IP version 10.2.2
when HTTP_REQUEST {
if {[HTTP::uri] contains "CA" } and {[IP::addr [IP::client_addr] equals 10.10.0.0/21]} {
HTTP::red...
PeteWhite
Employee
Oct 17, 2014Sorry, just looked at the back and it strikes me that you're only ever going to get as far as the else on the first if statement. Presumably you want to use nested if statements instead:
when HTTP_REQUEST {
if { ([HTTP::uri] contains "CA") } {
if { ([IP::addr [IP::client_addr] equals 10.10.0.0/21]) }
{
HTTP::redirect "https://public.example.com"
} else {
HTTP::redirect "https://inside.example.com"
}
}
if { ([HTTP::uri] contains "MTN") {
{
if { ([IP::addr [IP::client_addr] equals 10.10.0.0/21]) }
{
HTTP::redirect "https://public.example.com"
} else {
HTTP::redirect "https://inside.example.com"
}
}
if { ([HTTP::uri] contains "UK") }
{
if {([IP::addr [IP::client_addr] equals 172.30.144.0/22]) }
{
HTTP::redirect "https://public.example.com"
} else {
HTTP::redirect "https://inside.example.com"
}
}
discard
}
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects
