Forum Discussion
Pool Selection based on HOST and URI
Hello,
I am trying to figure out an irule for pool selection for the following scenario
I have 2 DNS entries pointing to the same public ip dns1.abc.com dns2.abc.com
For each of the above, i have 2 clients
dns1.abc.com/client1 dns1.abc.com/client2 dns2.abc.com/client1 dns2.abc.com/client2
Based on the Host/URI i want to point the user to apprpriate pool dns1client1 pool dns1client2 pool dns2client1 pool dns2client2 pool
Will the following irule work and is there a more efficient way of getting the desired result
when HTTP_REQUEST {
switch [ string tolower [HTTP::host]]
{
"dns1.abc.com" {
switch -glob [ string tolower [HTTP::URI]]{
"/client1" {pool dns1client1}
"/client2" {pool dns1client2}
}
}
"dns2.abc.com" {
switch -glob [ string tolower [HTTP::URI]]{
"/client1" {pool dns2client1}
"/client2" {pool dns2client2}
}
}
}
}
1 Reply
- Kevin_Stewart
Employee
I'd recommend this exact process. The only thing I might add is that you're using a "-glob" option in the switch but using static URIs. Will the request always be for "/client1", or will it perhaps have some URI data after it (ex. "/client1/foo/bar/blah")? If so, it'd be more appropriate to use ""/client1*" in the switch condition.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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