Forum Discussion
chrismckean_190
Nimbostratus
Mar 12, 2015Https redirect with exceptions not working
Hi Guys,
I was hoping someone might be able to help me. I'm trying to put an irule in that redirects all urls to https from http bar some exceptions. I've currently got the below rule (bottom...
- Mar 13, 2015
If I go to the site it redirects to https.
may the redirect be done by server?
have you ever used http analyzer tool? it may be helpful.
HttpFox
https://addons.mozilla.org/en-us/firefox/addon/httpfox/
Michael_Jenkins
Cirrostratus
Mar 12, 2015It could be a couple of different things. One is that you should almost always to a
string tolower on your hosts and uris in iRules so you can basically do a case-insensitive search (unless casing matters for you). If the casing were different in your case here, that would be one reason it wouldn't work right.
Another thing to do would be to add logging (see below) and check the
ltm log to see what's actually coming through. That may help determine why this is happening.
when HTTP_REQUEST {
set uri [string tolower [HTTP::uri]]
log local0. "Host: '[HTTP::host]'"
log local0. " URI: '$uri'"
if { [string tolower [HTTP::host]] starts_with "admin" } {
log local0. " Match: host starts with 'admin'"
pool pool1-http
} elseif { $uri contains "/admin" } {
log local0. " Match: uri contains '/admin'"
pool pool1-http
} elseif { $uri contains "/schedule" } {
log local0. " Match: uri contains '/schedule'"
pool pool1-http
} else {
log local0. " No match: redirect"
HTTP::redirect https://[HTTP::host][HTTP::uri]
return
}
}
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