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 way:
if i connect to http://www.mywebip.com/ i redirect to https://www.webip.com/login
If i am on https://www.webip.com
i don't want to leave websecure server for all uri /login and /secure
but i ask another uri , i want to return in http mode.
My problem is the following:
when i connect http, i go to https, all is ok, but when https redirect to http, my website send me http://www.webip.com and i have a loop.
What can i do to avoid that?
I have a irule for http and a irule for https
my http irule is :
when HTTP_REQUEST {
if { [HTTP::uri] equals "/" }{
HTTP::redirect "https://www.webip.com"}
my https irules is:
when HTTP_REQUEST {
if { [HTTP::uri] starts_with "/login" } {
log "blahblah"
} elseif { [HTTP::uri] starts_with "/secure" } {
log "blahblah2"
} else {
HTTP::redirect "http://www.webip.com[HTTP::uri]" }
}
i am sure it's very easy, but i am starting with irule...
Thanks
- Colin_Walker_12Historic F5 AccountWell, it sounds like all you'd need to do to stop the redirect loop is add the proper check to your HTTP rule.
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]" } }
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]" } }
- laurent_marion_
Nimbostratus
thanks colin, i find the solution. - Colin_Walker_12Historic F5 AccountSure thing, I'm glad to hear we could help.
- zafer
Nimbostratus
Hello - iku_72301
Nimbostratus
hi, berberz - F5_LB_Eng
Cirrostratus
Hi All, - hoolio
Cirrostratus
Hi Prasanna,
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