string map insert

I have the following uris that I would like to map a string and prepend a value to the string (in the examples below snt )

Any help with the iRules would be greatly appreciated

“/here.there/service/v1/customers/qualification” “/snt/here.there/service/v1/customers/qualification”

then use pool

“/here.there/service/v1/accounts/{accountNumber}” “/snt/here.there/service/v1/accounts/{accountNumber}”

then use pool

“/here.there/service/v1/accounts/{accountNumber}/paymentprofile” “/snt/here.there/service/v1/accounts/{accountNumber}/paymentprofile”

then use pool

Is the "{accountNumber} variable? What’s the format?

Are these URLs literal, or do they include their sub-directories/paths?

The urls are literal. Thanks

Try something like this one then:

when HTTP_REQUEST {
    switch -- [string tolower [HTTP::uri]] {
        "/here.there/service/v1/customers/qualification" {
            HTTP::uri /snt[HTTP::uri]
            pool pool_1
        }
        "/here.there/service/v1/accounts/\{accountNumber\}/paymentprofile" {
            HTTP::uri /snt[HTTP::uri]
            pool pool_2
        }
        "/here.there/service/v1/accounts/\{accountNumber\}" {
            HTTP::uri /snt[HTTP::uri]
            pool pool_3
        }
        default {
            pool default_pool
        }
    }
}

.

Thanks JG for the quick responses. I tried this that worked. I could do this because I’m using the same pool for all my earlier examples.

when HTTP_REQUEST {

set uri [HTTP::uri [string map {"/here.there " "/snt/here.there "}[HTTP::uri]]]

pool pool_name

}

realized I was just pre-pending snt (more like a find and replace)

Thanks again!