Forum Discussion
Nick_Coelho_338
Nimbostratus
Mar 03, 2007iRule works but getting browser error, help!
need an iRule that looks for trafficui and gives pool but if it does not see trafficui it looks for the hostname and redirects
it seems to work but i get errors on the "test1.com" links. better way to do this?
thanks for any help
when HTTP_REQUEST {
if { [HTTP::uri] starts_with "/TrafficUI" } {
pool Testy
}
elseif { [HTTP::host] starts_with "test1" } {
HTTP::redirect "http://www.test1.com/TrafficUI/mscui/page.aspx?cid=1&ptid=5"
}
elseif { [HTTP::host] starts_with "www.test1" } {
HTTP::redirect "http://www.test1.com/TrafficUI//mscui/page.aspx?cid=1&ptid=5"
}
elseif { [HTTP::host] starts_with "test2" } {
HTTP::redirect "http://www.test2.com/TrafficUI/mscui/page.aspx?cid=1&ptid=10"
}
elseif { [HTTP::host] starts_with "www.test2" } {
HTTP::redirect "http://www.test2.com/TrafficUI//mscui/page.aspx?cid=1&ptid=10"
}
elseif { [HTTP::host] starts_with "test" } {
HTTP::redirect "http://www.google.com/"
}
}
- At first glance, it looks good to me (besides the double slash in the "www.test1" and www.test2 redirects - unless this is what you intended). What kind of errors are you getting?
when HTTP_REQUEST { if { [HTTP::uri] starts_with "/TrafficUI" } { pool Testy } else { switch -glob { [HTTP::host] } { "test1*" - "www.test1*" { HTTP::redirect "http://www.test1.com/TrafficUI/mscui/page.aspx?cid=1&ptid=5" } "test2*" - "www.test2*" { HTTP::redirect "http://www.test2.com/TrafficUI/mscui/page.aspx?cid=1&ptid=10" } "test*" { HTTP::redirect "http://www.google.com/" } } } }
- Nick_Coelho_338
Nimbostratus
thanks for the help - Nick_Coelho_338
Nimbostratus
you think this is better than the if, elseif? - Nick_Coelho_338
Nimbostratus
that seems to work better, thanks for all the help - Nick_Coelho_338
Nimbostratus
is there a better way to get this done? i tried a switch - glob [HTTP::uri] and then switch - glob [HTTP:host] but it just skipped right over the uri section
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