Trouble with switch statements and multiple http::host and http::uri
I've scripted an iRule in hopes of being able to consolidate multiple rules together. This rule is supposed to check the host, check the uri, and evaluate both, and redirect where needed.
The first host check is working fine (events.oursite.com) and redirects fine, however if I try to enter the second host into my browser, I'm simply not being redirected properly. (adifferentsite.com)
I'm stumped, in the meantime I'm going to try and improve on my syntax. Can anyone point me in the right direction as far as where I may be going wrong? Thank you in advance!
Here's the rule:
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::host]] {
"events.oursite.com" {
Check the URI, set to lowercase
switch [string tolower [HTTP::uri]] {
"/eventpage.aspx?event=something08" {
HTTP::redirect "http://redirecteddomain.com"
return
}
}
switch -glob [string tolower [HTTP::host]] {
"adifferentsite.com" {
Check the URI, set to lowercase
switch [string tolower [HTTP::uri]] {
"/presentations*" {
HTTP::redirect "http://some.site.com/information/download-resources.aspx"
return
}
}
}
}
}
}
}