Forum Discussion
nrg2brn_163859
Mar 05, 2015Nimbostratus
minor irule change, but its my first one. go easy on me.
hello, I have a simple if then else type of irule, depending on what uri is presented. I need to make a couple of pools - erma2 and erma3 and add them to the irule. its below, looks pretty simple, bu...
Brad_Parker
Mar 05, 2015Cirrus
May I suggest using something like below. Since you are trying to match based on the start of the uri, use HTTP::uri. Also, looks like the start of your uri's are the application roots, so if you match with glob(_) adding the second "/" will ensure you get the expected behavior. But, yes in theory /erma2* and /erma3* should match before getting to your /erma* switch.
when HTTP_REQUEST {
Check the requested path with wildcard matching
switch -glob [HTTP::uri] {
"/rradmin/*" {
/rradmin URI
log local0. "[IP::remote_addr]: Request for /rradmin sent to pool pool_rradmin_ecms.gov_new_443"
pool pool_rradmin_ecms.epa.gov_443
}
"/erma2/*" {
/erma2 URI
log local0. "[IP::remote_addr]: Request for /erma2 sent to pool pool_erma2_ecms.epa.gov_new_443"
pool pool_erma2_ecms.epa.gov_443
}
"/erma3/*" {
/erma3 URI
log local0. "[IP::remote_addr]: Request for /erma3 sent to pool pool_erma3_ecms.epa.gov_new_443"
pool pool_erma3_ecms.epa.gov_443
}
"/erma/*" {
/erma URI
log local0. "[IP::remote_addr]: Request for /erma sent to pool pool_erma_ecms.epa.gov_new_443"
pool pool_erma_ecms.epa.gov_443
}
default {
everything else
URI log local0. "[IP::remote_addr]: Default ecms.epa.gov sent to pool_default_ecms.epa.gov_new_443"
pool pool_default_ecms.epa.gov_443
}
}
}
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