ltm rule command URI path
iRule(1) BIG-IP TMSH Manual iRule(1)
URI::path
Returns the path portion of the given URI.
SYNOPSIS
URI::path URI_STRING (depth | START | (START END))?
DESCRIPTION
Returns the path portion of the given URI.
Syntax
URI::path
* Returns the path portion of the given URI excluding the basename.
URI::path depth
* Returns the path depth
URI::path
* Returns the path portion of the given URI starting from 'start' depth
URI::path
* Returns the path portion of the given URI over the range 'start' depth to
'end' depth (with start >= 1).
RETURN VALUE
Returns the path portion of the given URI.
VALID DURING
ANY_EVENT
EXAMPLES
A simple test rule which demonstrates uses of the URI::query commandsAX
when RULE_INIT {
# You can use URI::query against a static string and not in a client-triggered event!
log local0. "\[URI::query \"?param1=val1¶m2=val2\" param1\]: [URI::query "?param1=val1¶m2=val2" param1]"
# This doesn't work, as URI::query expects a query string to start with a question mark
log local0. "\[URI::query \"param1=val1¶m2=val2\" param1\]: [URI::query "param1=val1¶m2=val2" param1]"
}
when HTTP_REQUEST {
# Log the test URI
log local0. "\[HTTP::uri\]: [HTTP::uri]"
log local0. "\[URI::basename \[HTTP::uri\]\]: [URI::basename [HTTP::uri]]"
log local0. "\[URI::path \[HTTP::uri\]\]: [URI::path [HTTP::uri]]"
log local0. "\[URI::path \[HTTP::uri\] depth\]: [URI::path [HTTP::uri] depth]"
log local0. "\[URI::path \[HTTP::uri\] 1\]: [URI::path [HTTP::uri] 1]"
log local0. "\[URI::path \[HTTP::uri\] 2\]: [URI::path [HTTP::uri] 2]"
log local0. "\[URI::path \[HTTP::uri\] 3\]: [URI::path [HTTP::uri] 3]"
log local0. "\[URI::path \[HTTP::uri\] 1 3\]: [URI::path [HTTP::uri] 1 3]"
log local0. "\[URI::path \[HTTP::uri\] 2 3\]: [URI::path [HTTP::uri] 2 3]"
# This isn't a valid range, so expect a TCL error! Ranges start with 1.
log local0. "\[URI::path \[HTTP::uri\] 0 3\]: [URI::path [HTTP::uri] 0 3]"
}
And the corresponding log output:
Rule : [URI::query "?param1=val1¶m2=val2" param1]: val1
Rule : [URI::query "param1=val1¶m2=val2" param1]:
: [HTTP::uri]: /path/to/file.ext?param=value
: [URI::basename [HTTP::uri]]: file.ext
: [URI::path [HTTP::uri]]: /path/to/
: [URI::path [HTTP::uri] depth]: 2
: [URI::path [HTTP::uri] 1]: /path/to/
: [URI::path [HTTP::uri] 2]: /to/
: [URI::path [HTTP::uri] 3]: /
: [URI::path [HTTP::uri] 1 3]: /path/to/
: [URI::path [HTTP::uri] 2 3]: /to/
01220001
HINTS
SEE ALSO
CHANGE LOG
@BIGIP-9.2.0 --First introduced the command.
BIG-IP 2017-01-31 iRule(1)