Miron_du_Plessi
Nov 03, 2007Nimbostratus
HTTP Redirect based on URI
Hi,
I have a webserver behind our LTM. Access to the webserver is working correctly when users use the full url of
https://remedy.xxx.net/arsys/home
however we are trying to ensure that they reach the correct webpage even if they type.
https://remedy or
https://remedy.xxx.net
However when they type this they are directed to the default apache page.
To do this on the load balancer instead of the webserver I thought that the following irules should solve the problem.
However it appears to have no effect, and im thinking that the problem may lie with the if statements. I did try and test if the redirect will work without the if statements which appeared to work obviously with errors as expected.
****************************************************
when HTTP_REQUEST {
set uri [HTTP::uri]
if { $uri ends_with "/remedy" } {
HTTP::redirect "https://remedy.xxx.net/arsys/home"
} elseif { $uri ends_with "/remedy.xxx.net" } {
HTTP::redirect "https://remedy.xxx.net/arsys/home"
}
}
****************************************************
when HTTP_REQUEST {
if { [HTTP::uri] ends_with "/remedy"} {
HTTP::redirect "https://remedy.xxx.net/arsys/home"
} elseif { [HTTP::uri] ends_with "/remedy.xxx.net"} {
HTTP::redirect "https://remedy.xxx.net/arsys/home"
}
}
I know there are a few topics already on this subject, which seem to suggest that it is quite easy.
Any ideas.
Regards
Miron