Mark_S__182830
Jan 15, 2015Nimbostratus
Adding Catchall Behavior to iRule
With the following iRule, when I hit domain.com/ShortName1_Anything here, it will keep the URI portion intact and pass it to the default pool for the VIP.
if { [HTTP::uri] eq "/ShortName1*" } {
}
elseif { [HTTP::uri] eq "/BLAH/ShortName1*" } {
HTTP::uri "/ShortName1"
pool CUSTOM_POOL2
}
My company wants a catch all if the user does not type in a valid /ShortName to redirect to a default one. When I add the following section of code, it states there is a redirect loop in my browser:
elseif {([HTTP::host] contains "sub.domain.com") && !([HTTP::uri] eq "/ShortName1*")} {
HTTP::redirect "/ShortName1"
pool CUSTOM_POOL1
}
I have tried several different approaches from browsing in the forums, and cannot seem to get a working catch-all.
The goal is to have all traffic that is does not resolve to /ShortName1 or /ShortName2, to default to /ShortName1.
Am I missing something or perhaps there is an easier way to do this? Thank you.