You could use a switch statement or two to do this. It should save you a few evaluations of [string tolower [HTTP::host]].
I'm not sure if you want to do an exact check or a wildcard check of the URI to see if they start with /path1 or /path2. This example does a wildcard check. If you want exact matching, remove the -glob flag from the switch statement and the *'s from the switch cases.
1. companytest.abc.com/path1 to companypath1.abc.com/test
2. companytest.abc.com/path2 to companypath2.abc.com/test
3. companytest.abc.com to company.abc.com/test
when HTTP_REQUEST {
Check the requested host
switch [string tolower [HTTP::host]] {
"companytest.abc.com" {
Check requested URI
switch -glob [HTTP::path] {
"/path1*" {
HTTP::redirect "http://companypath1.abc.com/test"
}
"/path1*" {
HTTP::redirect "http://companypath2.abc.com/test"
}
"/" {
HTTP::redirect "http://company.abc.com/test"
}
default {
Take some default action?
}
}
}
default {
Will other host header values be used in requests to the VIP
If so, take some default action?
}
}
}
Aaron