URI::path returns null without trailing slash (/)

Hi,

I’m trying to workout some redirects based on the first level of the URI path.

set rPath [string tolower [URI::path [HTTP::uri] 1 1]]

when I hit the iRule with “https://something.com/path1/”  I get “/path1/”.  But if I hit it with “https://something.com/path1” I get nothing and my switch statement fails if I try and match “/path1”.  If I forget the path and just do HTTP::uri it works, but of course I could end up with more than just the first level (right?).

However, in a different iRule which does this:

set NEW_URL [class match -value $rPath equals MYDATAGROUP]

and that seems works.  I’m on LTM v14 and I’m a little confused.

I’d appreciate any advise at all.

Hello @SteveBy5 ,

You have a great explanation of how URI::path works.

Anyway, in your case you can use something like this:

[HTTP::uri starts_with "/path1"]