Forum Discussion
peter_siman
Nimbostratus
May 29, 2011Pool selection based on URI string
Hi,
I have writtend a simple iRule to select particular pool based on what the URI string is. See below the iRule. Unfortunatelly, when applied a following messsages show up in logs.
...
The_Bhattman
Nimbostratus
Jun 13, 2011Hi Bob,
There are 2 ways to go about this. You can use the switch statement if there is small list of paths you want to check for or you can can use class objects
Here is the switch command
when HTTP_REQUEST {
switch -glob [string tolower[HTTP::path] ] {
"/mcbob*" -
"/path2*" -
"/path3*" {
pool secure2.mydomain.com
}
default {
pool secure2.mydomain.com
}
}
}
Or you can use datagroups which works well when you have lots of different paths you want to take into account
class mypaths {
"/mcbob"
"/path1"
"/path2"
"/path3"
}
when HTTP_REQUEST {
if {[class match -value [string tolower [HTTP::path]] starts_with "mypaths" ] } {
pool secure2.mydomain.com
} else {
pool secure.mydomain.com
}
}
Note: This is untested code
I hope this helps
@Bhattman
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