Forum Discussion
Ravi_Rajan_7549
Nimbostratus
Mar 17, 2008Redirection with Multiple pools
Hi,
I am not very experienced with irules and have few queries as below -
I have two pools ex. poola and poolb. Each pool has few servers like -
poola - server1, server2
poolb - server3, server4.
Server1 & Server2 -
These servers are hosting web applications with URI - /abc and /xyz
Server3 & Server4-
These servers are hosting web applications with URI /pqr and /def
Now i have a single virtual server and i need an irule which does something like this -
For each incoming request, the irule should check the URI and based on URI, it should use the appropriate pool.
For ex - In case URI is /abc, then the virtual server should poola and If URI is /def then the virtual server should use poolb.
TIA,
Regards,
Ravi
- The_Bhattman
Nimbostratus
Hi Raviwhen HTTP_REQUEST { switch [HTTP::uri] "/abc" - "/xyz" { pool poola } "/pqr" - "/def" { pool poolb } } }
- Ravi_Rajan_7549
Nimbostratus
Hi, - The_Bhattman
Nimbostratus
There is a setting in the pool configuration where you can select the default pool. If the irules fail or it doesn't select the pool the default pool is choosen. - Ravi_Rajan_7549
Nimbostratus
Hi, - The_Bhattman
Nimbostratus
The class object can be defined in the followingclass dg_poola { "/abc" "/xyz" } class dg_poolb { "/prq" "/def" }
when HTTP_REQUEST { if { [matchclass [string tolower [HTTP::uri]] contains $::dg_poola] } { pool poola } else if { [matchclass [string tolower [HTTP::uri]] contains $::dg_poolb] } { pool poolb } } }
- Ravi_Rajan_7549
Nimbostratus
Hi, - Nicolas_Menant
Employee
Hi, - The_Bhattman
Nimbostratus
nmenant beat me to it.class dg_poolchoice { "/abc poola" "/xyz poola" "/prq poolb" "/def poolb" } when HTTP_REQUEST { set choosenpool [findclass [string tolower [HTTP::uri]] $::dg_poolchoice " "] if { $choosenpool != "" } { pool $choosenpool } }
- Ravi_Rajan_7549
Nimbostratus
Thanks a lot, earlier one worked fine. I will try this one too. This may be more cost effective in terms of CPU cycles. - Nicolas_Menant
Employee
Hi,
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