Rewriting URLs (stripping out prefix)

I’m new to iRules and I would like to be able to do something like so:

if URI starts with /2.4/rest_of_URL then

goto pool X but strip out 2.4 and have /rest_of_URL seen at destination

if URI starts with /2.5/rest_of_URL then

goto pool Y but strip out 2.5 and have /rest_of_URL seen at destination

I’ve done this type of thing with Apache’s mod_rewrite/mod_proxy, brain dead easy.

Anyway, f5 management is a very minor aspect of what I do day to day and I didn’t want to expend lots of time with experimentation and/or trying to find examples when I’m sure there’s a domain expert here that can answer the question trivially.

Regards,

-M

when HTTP_REQUEST {
  if { [HTTP::uri] starts_with "/2.4/" } {
    HTTP::uri [string replace [HTTP::uri] 0 3]
    pool x
  } elseif { [HTTP::uri] starts_with "/2.5/" } {
    HTTP::uri [string replace [HTTP::uri] 0 3]
    pool y
  }
}

RE: I didn’t want to expend lots of time with experimentation and/or trying to find examples …

The notion that your time is more valuable than the members of the community on which you lean…not liking that very much.

Come to think of it, since the string characters are numbers, you don’t need the tolower parameter. Edited for clarity in previous post.

Citizen thanks for the information… regarding your closing comment, I’m not implying my time is better than anyone else’s -- I came here to get an answer from domain experts. Take it at face value.

Cheers,

-M