Forum Discussion
Brian_Kenworthy
Nimbostratus
Jul 31, 2009Rule Modification Help with Switch
Hi all, I have the following existing rule that we will be adding another pool to. I am using the switch command, but am wondering if I need to add some if/else clauses. Here's the existing rule: ...
Aug 02, 2009
Just added it before the "default" case.
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::uri]] {
"/xml/order.asp*" -
"/xml/status.asp*" -
"/vmsxml/order.asp*" -
"/vmsxml/status.asp*" -
"/_xmlbeta/status_mismo21.asp*" -
"/_xmlbeta/status.asp*" -
"/_xmlbeta/rels_status_mismo21.asp*" -
"/vendor/status.asp*" {
pool host.mydomain.com_B2B_HTTPS
}
"/BatchProcessing*" {
pool host.mydomain.com_BatchPro_HTTPS
}
default {
pool host.mydomain.com_GUI_HTTPS
}
}
}
The dashes after the ones you already have are a way to do a logical "or" for a match for any of them. You can add as many match strings as you want like I did above if you want to expand your iRule.
BTW, I assume you accidentally omitted the "pool" statement from the match cases. If not, I didn't know you could just add a pool name without the actual "pool" command before it.
-Joe
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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