Rob_Wotton_8024
Oct 21, 2009Nimbostratus
Multiple Pool Redirection Based on IP
Hi
I am struggling with an iRule at the moment, in simple English when the URI starts with /product1 and is from IP address 1.1.1.1 we need to use pool product1-CustomerA. If the URI starts with /product1 and is requested by any other IP address then it needs to use pool product1.
I have written the below iRule but it only works if the IP is 1.1.1.1, the else statement doesn't seem to work, I am also not sure the rest of my syntax is correct as sometimes it works and other times it doesn't.
Anyhelp would be appreciated.
Thanks
Rob
when HTTP_REQUEST {
if { [IP::addr [IP::client_addr]/32 equals 1.1.1.1] } {
switch [string tolower [HTTP::uri]] {
"/product1" {
pool product1-CustomerA
}
"/product2" {
pool product2-CustomerA
}
"/product3" {
pool product2-CustomerA
}
default {
pool standardpool-CustomerA
}
else {
switch [string tolower [HTTP::uri]] {
"/product1" {
pool product1
}
"/product2" {
pool product2
}
"/product3" {
pool product2
}
default {
pool standardpool-CustomerB
}
}
}
}
}
}
}