Forum Discussion

SteveBy5's avatar
Icon for Nimbostratus rankNimbostratus
Aug 03, 2022

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


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 ""  I get "/path1/".  But if I hit it with "" 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.