Forum Discussion
Craig_Hoss_1781
Nimbostratus
Jan 12, 2009Change Case on Append IP iRule
I have a working iRule that appends the IP address on a client request. However, it is case sensitive. The URL must have "login.aspx" in the URL exactly for this to work, but I would like to make it...
hoolio
Cirrostratus
Jan 12, 2009You can use 'string tolower "original_string"' to set a string to lower case. You can eliminate some of the variables as well:
when HTTP_REQUEST {
Check if the path, set to lower case, ends with login.aspx
if {[string tolower [HTTP::path]] ends_with "login.aspx"}{
Check if there is a query string
if {[string length [HTTP::query]]}{
Append the IPAddress parameter with the client IP to the existing query string
HTTP::uri "[HTTP::uri]&IPAddress=[IP::client_addr]"
} else {
Append the IPAddress parameter with the client IP to the path
HTTP::uri "[HTTP::path]?IPAddress=[IP::client_addr]"
}
}
}
For an example URL:
http://www.example.com:80/path/to/file.ext?param1=value1¶m2=value2
These commands return the following values:
HTTP::host (Click here) - www.example.com:80
HTTP::path (Click here) - /path/to/file.ext
HTTP::query (Click here) - param1=value1¶m2=value2
HTTP::uri (Click here) - /path/to/file.ext?param1=value1¶m2=value2
Aaron
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects