Forum Discussion
chrismckean_190
Mar 12, 2015Nimbostratus
Https 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
Michael_Jenkins
Mar 12, 2015Cirrostratus
It 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
}
}
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