Forum Discussion
Girish_HS_32793
Nimbostratus
Aug 05, 2008Help: Redirect to https with URI
Hi Team,
I have a iRule setup for http which checks for URI and assigns the Node & port to be used.
when HTTP_REQUEST {
if { [HTTP::host] equals "mysite.someplace....
hoolio
Cirrostratus
Aug 06, 2008Hi 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
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects
