Forum Discussion
hooleylist
Aug 06, 2008Cirrostratus
Hi Giri,
You can check the host and/or URI with either if or switch statements. You can redirect the client to a new location using HTTP::redirect "http://subdomain.example.com/path/to/file.ext".
Here is a simple example which uses both switch and if:
when HTTP_REQUEST {
Check requested hostname
switch [string tolower [HTTP::host]] {
"order.asia.com" {
if {[HTTP::uri] starts_with "/homepage_asia"}{
log local0. "[IP::client_addr]:[TCP::client_port]: Matched order.asia.com/hompage_asia. \
Redirecting to https://order.asia.com[HTTP::uri]"
HTTP::redirect "https://order.asia.com[HTTP::uri]"
} else {
log local0. "[IP::client_addr]:[TCP::client_port]: Matched order.asia.com. Using pool http_pool"
pool $http_pool
}
}
"order.aus.com" {
log local0. "[IP::client_addr]:[TCP::client_port]: Matched order.aus.com. Redirecting to https://order.aus.com[HTTP::uri]"
HTTP::redirect "https://order.aus.com[HTTP::uri]"
}
default {
log local0. "[IP::client_addr]:[TCP::client_port]: Hit default clause."
HTTP::redirect "https://default.asia.com[HTTP::uri]"
}
}
}
This rule would be applied to the single HTTP VIP. I didn't try to follow your exact logic, but hopefully you can use the syntax to implement your requirements.
If all four domains currently resolve to the same IP address, you'll need one SSL certificate which is valid for all of the hostnames. Or you'll need to change the DNS to resolve to separate IP's and use separate SSL certificates.
Aaron