Forum Discussion
iRule which check uri or path contains
The HTTP::path "/api/app/" statement in your code is replacing the entire path with the value specified, not just the /api/app/1/ part. As a result, your path is changing from /api/app/1/workstation-params/100, for example, to just /api/app/, and dropping the workstation-params/100 part. To replace just the portion of the path string that needs to change and, more importantly, also select pool1, you could try something like this:
when HTTP_REQUEST {
if { [string tolower [HTTP::uri]] contains "/api/app/1/" } {
HTTP::uri [string map { "/api/app/1/" "api/app/" } [string tolower [HTTP::uri]]
pool pool1
} elseif { [string tolower [HTTP::uri]] contains "/api/app/" } {
pool pool1
} else {
pool2
}
}I don't see the need to check for "/api_aaa" separately as the last elseif and else conditions in your original code both do the same thing which is to select pool2 - but I could be missing something.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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
