HTTP::uri causes malformed URI
We are using the HTTP::uri command in an iRule to set a prefix on the given URI, and following the prefix example given in the F5 official documentation shown here: https://clouddocs.f5.com/cli/tmsh-reference/latest/modules/ltm/ltm_rule_command_HTTP_uri.html
The exact iRule we're using is this:
when HTTP_REQUEST {
set uri [string tolower [HTTP::uri]]
if { $uri starts_with "/firstPath/" or $uri contains "/secondPath" }{
HTTP::uri /thirdPath[HTTP::uri]
pool poolA
}
elseif { not ([HTTP::uri] starts_with "/otherPath") } {
HTTP::uri /otherPath[HTTP::uri]
pool poolB
}
}
This works as expected, except one request from a single known source results in a bad URI.
The elseif part that applies the prefix is the part that isn't working consistently. We've had this occur in two different environments across different LTMs on the same type of request.
The provided request URL is something like: https://www.company.com/foo/bar
We expect the URI to be rewritten as: /otherPath/foo/bar
But in fact the rewritten URI ends up as: /otherPathhttps:/www.company.com/foo/bar
This specific request is coming in as POST HTTP/1.0. I'm not a network engineer so I don't know if there's anything somewhere else on the LTM that would be affecting this type of request, or if there's something else this specific request could be hiding that would cause the iRule to behave this way. The LTMs are all running version 15.1.3.1.