Forum Discussion
Fotios_30046
Nimbostratus
Feb 26, 2010Combine Two Rules Into One
I have two rules that perform the same function but on different domains. If a subfolder of /products is found use a different pool, otherwise use the default. My question is, can these be combined ...
Feb 26, 2010
You can do it several ways and the deciding factor is which makes more sense to you. Performance should be equivalent. Either of these should work
when HTTP_REQUEST {
switch [HTTP::host] {
"www.domain1.com" {
switch -glob [HTTP::uri] {
"/products*" { pool Altruik-Furniture }
default { pool Furniture-Production-Pool-HTTP }
}
}
"www.domain2.com" {
switch -glob [HTTP::uri] {
"/products*" { pool Altruik-CarpetOne}
default { pool CarpetOne-Production-Pool }
}
}
}
}
One question though. Is there a reason why you don't have the default pool setup for the virtuals in the virtual configuration? If you set the default for the domain1 virtual to Furniture-Production-Pool-HTTP and the default pool set for the domain2 virtual to CarpetOne-Production-Pool, then you could have an iRule that looks something like this
when HTTP_REQUEST [
if { [HTTP::uri] starts_with "/products" } {
switch [HTTP::host] {
"www.domain1.com" { pool Altruik-Furniture }
"www.domain2.com" { pool Altruik-CarpetOne }
}
}
}
Lots of options, just pick one that works for you!
-Joe
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