Forum Discussion
Hi Mike,
Could you tell me what port your virtual server is configured to use? Typically you'd have two virtual servers, one on TCP/80 and the other on TCP/443, That way you're explicit which ports are permitted.
A simple iRule like the one below will redirect anything that does NOT start with /exshortcut. If the URI does start with exshortcut, it will be allowed implicitly
when HTTP_REQUEST {
if {!([HTTP::uri] starts_with "/exshortcut")} {
HTTP::redirect "https://10.110.66.34/search"
}
}
This could also be completed using an LTM traffic policy
To answer your question about the redirect, yes if the IP address specified is that of the VS that the iRule is attached to, you will get caught in a loop. If you do not need to redirect, you could rewrite the using HTTP::uri, in order to do so you'd need to know what subsequent URIs would look like so that it is re-written correctly.
If still going down th redirect route, the following example will only redirect if the URI does not already start with /search
when HTTP_REQUEST {
if {!([HTTP::uri] starts_with "/exshortcut")} {
if {!([HTTP::uri] starts_with "/search")} {
HTTP::redirect "https://10.110.66.34/search"
}
}
}