Forum Discussion
Pool selection using iRule not working
Hi,
I am having a hard time writing an irule to select from pools based on URIs for the same host.
The irule looks like this.
=================================
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::host]] {
"site1.company.com" {
switch -glob [string tolower [HTTP::uri]] {
"/Tabs.aspx" {
pool site1-pool-port81
}
"/" {
HTTP::redirect "http://[HTTP::host]/Home.aspx";
pool site1-pool
}
}
}
"site2.company.com" {
switch -glob [HTTP::uri] {
"/" {
HTTP::redirect "http://[HTTP::host]/Home.aspx";
pool site2-pool
}
default {pool site2-pool}
}
}
"site3.company.com" {
switch -glob [HTTP::uri] {
"/" {
HTTP::redirect "http://[HTTP::host]/Home.aspx";
pool site3-pool
}
default {pool site3-pool}
}
}
}
}
=================================
Everything (site1, site2, site3) works fine except for ";. Since the default pool on the VS is "site1-pool", "site1-pool-port81" does not selected. I can see the requests going to the wrong pool via 'tmsh'.
On the other hand, if the default pool on the VS is set to "site1-pool-port81", "; starts working, but then, "/" stops redirecting to the home page. Even trying to access "site1.company.com/Home.aspx" fails.
Any help would be highly appreciated!
-Jimmy =-=-=
- Lee_Sutcliffe
Nacreous
Try changing this line of the switch statement to lower case:
"/Tabs.aspx"
You've done a string tolower on the URI but are then comparing it against a string with an upper case character.
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