Forum Discussion
crodriguez
Nov 02, 2018Ret. Employee
There are quite a few ways to do this. One way is to use five pools, each with one pool member at the appropriate port address. (That way you're not stuck with a pool member that can process traffic on any port.) So, lasrt_pool has pool member 10.10.100.190:4443, lasrx_pool has pool member 10.10.100.190:4444, and so on. Your iRule might look something like this:
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::host]] {
"lasrt.cars.auto.com" { pool lasrt_pool }
"lasrx.cars.auto.com" { pool lasrx_pool }
"lasru.cars.auto.com" { pool lasru_pool }
"lasrd.cars.auto.com" { pool lasrd_pool }
"vision.cars.auto.com" { pool vision_pool }
}
}
`
One scenario this doesn't deal with is if traffic arrives on the virtual server with a host that is something other than the five options defined above. You might want to include a default option that drops the connection (or does something else) if you get a different host. Also, if there's any chance someone might send a port number along with the host (e.g. lasrt.cars.auto.com:4443), you will need to take that into consideration by perhaps using if-elseif statements and "starts_with" (which you can't do with switch). For example:
`if { [string tolower [HTTP::host]] starts_with "lasrt.cars.auto.com" } {
pool lasrt_pool
} elseif { [string tolower [HTTP::host]] starts_with "lasrx.cars.auto.com" } {....