Hi Miron,
You can add log statements to your rule and then tail the /var/log/ltm log file (tail -f /var/log/ltm) to see what values you're getting:
when HTTP_REQUEST {
log local0. "URI: [HTTP::uri]"
if { $uri ends_with "/remedy" } {
log local0. "URI: [HTTP::uri] matched /remedy check"
HTTP::redirect "https://remedy.xxx.net/arsys/home"
} elseif { $uri ends_with "/remedy.xxx.net" } {
log local0. "URI: [HTTP::uri] matched /remedy.xxx.net check"
HTTP::redirect "https://remedy.xxx.net/arsys/home"
}
}
I think you're mixing up the Host header value and the URI that HTTP::uri returns. If a client requests
https://test.example.com/path/to/file.ext, [HTTP::host] will return "test.example.com". [HTTP::uri] will return "/path/to/file.ext".
You probably want to try something like this:
when HTTP_REQUEST {
log local0. "Host: [HTTP::host], URI: [HTTP::uri]"
if { [string tolower [HTTP::host]] eq "remedy"} {
log local0. "Host: [HTTP::host] matched remedy check"
HTTP::redirect "https://remedy.xxx.net/arsys/home"
} elseif { [string tolower [HTTP::host]] eq "remedy.xxx.net" } {
log local0. "Host: [HTTP::host] matched remedy.xxx.net check"
HTTP::redirect "https://remedy.xxx.net/arsys/home"
}
}
Alternately, if you want to redirect any request to the VIP that's not made to remedy.xxx.net, you could just do a single test:
when HTTP_REQUEST {
log local0. "Host: [HTTP::host], URI: [HTTP::uri]"
if { not ([string tolower [HTTP::host]] eq "remedy.xxx.net")} {
log local0. "Host: [HTTP::host] didn't match remedy.xxx.net; redirecting."
HTTP::redirect "https://remedy.xxx.net/arsys/home"
}
}
Aaron