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
JG
2
Is the "{accountNumber} variable? What’s the format?
JG
3
Are these URLs literal, or do they include their sub-directories/paths?
The urls are literal. Thanks
JG
5
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!