URI rewrite assistance
Hello all,
I am looking to hopefully do a simple irule uri rewrite, but this one is stumping me. I have a request to rewrite a uri from: http://somehost.com/reports/api/ to http://somehost.com/reports/api/v1/. Simple enough, and I got that to work with the irule below. But, they have several uri's that start with something different, so instead of reports it could be /admin/, /card/, /fee/ etc... I prefer the irule to be dynamic if possible and not have to list each directory out, and if possible use an asterisks or something for matching on */api/ and rewrite to */api/vi/. Hopefully this makes sense.
Those would look like: http://somehost.com/admin/api/ http://somehost.com/card/api/ http://somehost.com/fee/api/
So, is there a way to write an irule and use an asterrisks
when HTTP_REQUEST {
if { [string tolower [HTTP::uri]] starts_with "/reports/api/" } {
set uri [string map -nocase {"/reports/api/" "/reports/api/v1/"} [HTTP::uri]]
HTTP::uri $uri
}
}
Any help is appreciated.