If the application uses HTTPS, this becomes more complicated as you can only really support one SSL cert on a single VIP. Here is one method for HTTP where you select the pool based on the HTTP host header value:
when HTTP_REQUEST [
Make a pool selection based on the host header value (set to lowercase)
switch [string tolower [HTTP::host]] {
"test1.example.com" {
test1
log local0. "[IP::client_addr]:[TCP::client_port]: test1.example.com, using test1 pool"
pool test1_pool
}
"test2.example.com" {
test2
log local0. "[IP::client_addr]:[TCP::client_port]: test2.example.com, using test2 pool"
pool test2_pool
}
"test3.example.com" {
test3
log local0. "[IP::client_addr]:[TCP::client_port]: test2.example.com, using test3 pool"
pool test3_pool
}
default {
didn't match specific case
log local0. "[IP::client_addr]:[TCP::client_port]: hit default, using pool1"
pool test1_pool
}
}
}
I'm guessing this won't exactly match your scenario, but hopefully it gets you started.
Aaron