Forum Discussion
May 24, 2006
As long as the rule can compile (due to the elseif's on new lines), then it should functionaly work. I would add some logging in to output the values of the HTTP::host and HTTP::uri variables and then a log statement for the condition that matched. starts_with and equals are case-sensitive. Maybe that could be the issue. No way to tell without some input data.
BTW, in the future, I'd recommend avoiding elseif's and else's on newlines. That isn't supported by TCL and our implementation of that has some problems under certain situations such as trailing spaces on the previous lines).
I'd start with something like this:
when HTTP_REQUEST {
log local0. "Host: [HTTP::host], URI: [HTTP::uri]"
if { [HTTP::host] starts_with "a.company.com" } {
log local0. "host matched a.company.com"
HTTP::redirect "https://www.company.com/123/Login.html"
} elseif { [HTTP::host] starts_with "company.com" } {
log local0. "host matched company.com"
HTTP::redirect "https://www.company.com/123/Login.html"
} elseif { [HTTP::uri] equals "/" } {
log local0. "URI matched '/'"
HTTP::redirect "https://[HTTP::host]/123/Login.html"
} elseif { [HTTP::uri] equals "/Login.html" } {
log local0. "URI matched /Login.html"
HTTP::redirect "https://[HTTP::host]/123/Login.html"
} elseif { [HTTP::uri] equals "/456/index.html" } {
log local0. "URI matched /456/index.html"
HTTP::redirect "https://[HTTP::host]/123/Login.html"
} elseif { [HTTP::uri] equals "/mobileLogin.html" } {
log local0. "URI matched /mobileLogin.html"
HTTP::redirect "https://[HTTP::host]/123/Login.html"
} else {
log local0. "URI match not found, using default case"
HTTP::redirect https://[HTTP::host][HTTP::uri]
}
}
Then take a look at the /var/log/ltm file on the BIG-IP to find out why your cases don't work.
-Joe