I have requirement to select pool base on context root. I created two pools and use below irule, however it didn’t work, under virtual server I didn’t apply any pool under Virtual server ? is that why below iRule didn’t work? when HTTP_REQUEST { switch -glob [string tolower [HTTP::uri]] { “/outpool" { pool outpool_7001_Pool } "/Inpool” { pool Inpool_7003_Pool } }
If you select a pool via an iRule there’s no need to configure a default pool. A drawback is that you can’t readily tell whether a VIP is up or down since it doesn’t have any pool members.
As for your iRule, it will do an exact match of “/outpool” and “/inpool”. My guess is that you’ll want to select pools based on the beginning of the path. You can do that by adding an asterisk (*) at the end of the string.
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::uri]] {
"/outpool*" {
pool outpool_7001_Pool
}
"/Inpool*" {
pool Inpool_7003_Pool
}
}
}