Forum Discussion
laurent_marion_
Nimbostratus
Jan 27, 2006https, http redirect tips & tricks
Hi,
i worked with irule and i have a small problem:
i have an internet website in https and http
my browser go to http://www.mywebip.com/
i want to follow this ...
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
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects