Forum Discussion
Colin_Walker_12
Jan 30, 2006Historic F5 Account
Well, it sounds like all you'd need to do to stop the redirect loop is add the proper check to your HTTP rule.
Assuming you only want the HTTP rule to redirect to HTTPS if they are trying to view a page inside of /secure or /login, then you'd do something like this:
when HTTP_REQUEST {
if { [HTTP::uri] equals "/" } {
HTTP::redirect "https://www.webip.com/login"
} elseif { ( [HTTP::uri] starts_with "/login") or ( [HTTP::uri] starts_with "/secure") } {
HTTP::redirect "https://www.webip.com[HTTP::uri]"
}
}
You'd then want to change your HTTPS rule to look something like:
when HTTP_REQUEST {
if { [HTTP::uri] starts_with "/login" } {
log "blahblah"
} elseif { [HTTP::uri] starts_with "/secure" } {
log "blahblah2"
} elseif { ( [HTTP::uri] equals "" ) or ( [HTTP::uri] equals "/") } {
log "blahblah3"
} else {
HTTP::redirect "http://www.webip.com[HTTP::uri]"
}
}
I think that should get you where you need to go. The biggest change is making sure that your HTTPS rule is checking for an empty URI, and not redirecting if the URI is empty.
HTH,
-Colin