Forum Discussion
Jacob_Becker_41
Nimbostratus
Jun 21, 2006https redirect
I'm trying to do a irule that will account for the following situation. If a person goes to https://felixlive.com I want it to redirect to https://www.felixlive.com. I've tried the following rules.
when HTTP_REQUEST {
log local0. "Host: [HTTP::host], URI: [HTTP::uri]"
if { [HTTP::host] starts_with "felixlive.com" } {
log local0. "host matched felixlive.com"
HTTP::redirect "https://www.felixlive.com"
}
}
when HTTP_REQUEST {
if {[HTTP::host] equals "https://felixlive.com" } {
HTTP::redirect https://www.felixlive.com
}
}
But with each attempt I'm getting a certificate problem, not to the redirect isn't working correctly. Is there something special I need to do when doing a https redirect?
- Deb_Allen_18Historic F5 AccountThe first rule should work. (The second should also work if you removed the "https://" from the HTTP::host comparison -- the host is simply the hostname portion of the URL.)
- Jacob_Becker_41
Nimbostratus
So couple of things I want to make sure I understand correctly. With this rule I want to catch people trying to going to https. With that said I'm assuming that the rule needs to be applied to the ssl web pool that I have sent up. So when I tried the following rulewhen HTTP_REQUEST { if {[HTTP::host] equals "felixlive.com" } { HTTP::redirect https://www.felixlive.com/ } }
when HTTP_REQUEST { log local0. "Host: [HTTP::host], URI: [HTTP::uri]" if { [HTTP::host] starts_with "felixlive.com" } { log local0. "host matched felixlive.com" HTTP::redirect "https://www.felixlive.com" } elseif { [HTTP::host] starts_with "www.felixlive.com" } { log local0. "host matched www.felixlive.com" HTTP::redirect "https://www.felixlive.com" } else { HTTP::redirect https://[HTTP::host][HTTP::uri] } }
if { [HTTP::host] starts_with "felixlive.com" } { log local0. "host matched felixlive.com" HTTP::redirect "https://www.felixlive.com"
- Jacob_Becker_41
Nimbostratus
Actually the more I'm digging through this the more I'm realizing that it is a problem with how the cert is setup. Thanks!!! - Deb_Allen_18Historic F5 AccountIf by "redirect problem from my browser" you mean the cert warning, and the cert is for www.felixlive.com, then yes, that is the problem for the rule applied to the HTTPS virtual.
- Jacob_Becker_41
Nimbostratus
Actually I got that error from I'm assuming apache. With that rule applied in parallel with the other rule it would halt my ability to get to the website at all when I entered in the web address https://felixlive.com . Thats why I was wondering if I had a conflict with the other rule perhaps.
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