F5 iRule – URI, Path & Query

F5 iRule has the following 3 command list that can be a bit confusing. This is a short post to remember the differences between the 3 of them.

[HTTP::uri] – everything from “/” after the domain name to the end.

[HTTP::path]– everything from “/” after the domain name to the character before the “?”

[HTTP::query]– everything after the “?”

[HTTP::host] – domain name

In short:
[HTTP::uri] == [HTTP::path] + ? + [HTTP::query]

Example:
http://www.example.com/main/index.jsp?user=test&login=check

 [HTTP::uri]   - URI:   /main/index.jsp?user=test&login=check
 [HTTP::path]  - PATH:  /main/index.jsp
 [HTTP::query] - Query: user=test&login=check
 [HTTP::host]  - Host:  www.example.com

2 Replies to “F5 iRule – URI, Path & Query”

  1. You would need something like this (rough framework):

    when HTTP_REQUEST {
    if mobile browser {
    if { ([HTTP::host] eq “dell.abc.com”) and ([HTTP::uri] eq “/hr-forms/rest”)} {
    HTTP::respond 200 content [ifile get browser-wont-work.html] “Content-Type” “text/html”
    }
    }
    }

    In the above iRule, you have to use [HTTP::header “User-Agent”] to identify the mobile browser.

Leave a Reply