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
}
}