Forum Discussion
AaronB_8424
Jun 04, 2008Historic F5 Account
Please review this iRule
Can somebody tell me why this iRule might not work properly? We are seeing urls that should match an else statement go to a different pool (not necessarily the fallback pool). Sometimes things work, sometimes it does not. Any suggestions would be most appreciated!
Here is the rule:
rule pleaseGetThisWorking {
when SERVER_CONNECTED {
log local0. "Node IP address: [IP::server_addr]"
}
when HTTP_REQUEST {
if { [HTTP::uri] contains "/securemail" } {
HTTP::redirect "https://someotherdomain.com/messenger/"
}
elseif { [HTTP::uri] contains "/test/" } {
use pool pilotweb
}
elseif { [HTTP::uri] contains "/Reporting" } {
use pool Reporting_Production
}
elseif { [HTTP::uri] contains "/raersWeb" } {
use pool reporting
}
elseif { [HTTP::uri] contains "/teleform/" } {
use pool reporting
}
elseif { [HTTP::uri] contains "UnblindUtility.jsp"} {
HTTP::redirect "https://www.MAINVIRTUALSERVER.com/unblind/transition/transition.htm"
}
elseif { [HTTP::uri] contains "/unblind/transition/" } {
use pool reporting
}
elseif { [HTTP::uri] contains "/unblind" } {
use pool reporting
}
elseif { [HTTP::uri] contains "/cews/" } {
use pool reporting
}
elseif { [HTTP::uri] contains "/wiki/" } {
use pool calgborgweb
}
elseif { [HTTP::uri] contains "/jira/" } {
use pool finback_jira
}
elseif { [HTTP::uri] contains "/sso/" } {
use pool sso
}
elseif { [HTTP::uri] contains "/devsso/" } {
use pool devsso
}
elseif { [HTTP::uri] contains "/testsso/" } {
use pool testsso
}
elseif { [HTTP::uri] contains "/betasso/" } {
use pool betasso
}
elseif { [HTTP::uri] contains "/rss/" } {
use pool baiji_rss
}
elseif { [HTTP::uri] contains "/rtp/" } {
use pool reporting
}
elseif { [HTTP::uri] contains "/statcenter/" } {
use pool calgb.org_web_servers
}
elseif { [HTTP::uri] contains "/qt" } {
use pool reporting
}
elseif { [HTTP::uri] contains "/reporting"} {
HTTP::redirect "https://www.MAINVIRTUALSERVER.org/Reporting"
}
else {
set uri [HTTP::uri]
set UA [HTTP::header "User-Agent"]
log local0. "lb fallthrough: $uri browser $UA"
use pool oracleweb
}
}
}
- The_Bhattman
Nimbostratus
There is allot of IF-ELSEIF statements. It maybe more efficient to use the switch statementwhen HTTP_REQUEST { switch -glob [HTTP::uri] { "*/securemail*" { HTTP::redirect "https://someotherdomain.com/messenger/" } "*/test/*" { pool pilotweb } "/raersWeb*" { pool Reporting_Production } "*"/teleform/*" { pool reporting } . . . DEFAULT { set uri [HTTP::uri] set UA [HTTP::header "User-Agent"] log local0. "lb fallthrough: $uri browser $UA" pool oracleweb } } }
- AaronB_8424Historic F5 Accountusing the switch command is a good idea. When I get this rule to work properly I will try it.
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