At its simplest...
when HTTP_REQUEST {
switch -glob -- [string tolower [HTTP::uri]] {
"/thing-a/*" { pool "apiPoolA" }
"/thing-b/*" { pool "apiPoolB" }
default { HTTP::respond 400 content "Unsupported URI" noserver }
}
}
i.e., in the HTTP_REQUEST event, read the URI, convert it to lower-case (for easier comparing) and compare it to one or more simple patterns.
If the URI starts with /thing-a/, forward to one specific backend pool; if it starts with /thing-b/, forward to another.
If the URI does not match either of those patterns, respond with a basic HTTP error message.
Note that, to the BIGIP, the term "URI" means "the path and querystring". If you actually want just the path, try [HTTP::path]; if you want the hostname, try [HTTP::host]; or if you want both, consider "[HTTP::host][HTTP::uri]".
If you need the scheme (i.e. if it is HTTP or HTTPS), it can be a little trickier. Possibly [expr { [PROFILE::exists clientssl] ? "https" : "http" }].