Local Traffic Policy for complex URI transform; order of eval relative to iRules
New to 11.4, and getting my hands around Local Traffic Policies.
I have a scenario in which I evaluate starts-with against the URI, and depending on value, select a pool. But for certain URIs, I also change the URI in a non-trivial manner. For example:
when HTTP_REQUEST {
if {[HTTP::uri] starts_with "/MP"} {
pool pool1
} elseif {[HTTP::uri] starts_with "/MA/2.00"} {
HTTP::uri [string map {"/MA/2.00" "/MA"} [HTTP::uri]]
pool pool2
}
}
First – how do I do that URI transformation with a Policy? Target: http-uri has parameters of path, query-string and value. Can I just select “value” and add “[string map {"/MA/2.00" "/MA"} [HTTP::uri]]”? I mean, does an action get evaluated that way, such that you can use TCL string functions and data class references?
As an alternative, I considered using the Policy to select a pool (easy to do), and leaving the URI transform as a smaller, simpler iRule – but which gets run first, the Policy or the iRules? If the iRule went first, it would prevent to Policy "URI starts-with" condition from being met, because the URI would have been changed to not match, and no pool would get selected.
Sorry if this kind of thing is clarified somewhere – I couldn’t find it if so.