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 work with "Login.aspx", "LOGIN.aspx", etc. Does anyone know how to change the case of the incoming URL ?
when HTTP_REQUEST {
set client [IP::client_addr]
set request [HTTP::uri]
if {$request contains "login.aspx" and $request contains "?"}
{HTTP::uri "[HTTP::uri]&IPAddress=[IP::client_addr]"}
elseif {$request contains "login.aspx"}
{HTTP::uri "[HTTP::uri]?IPAddress=[IP::client_addr]"}
}
Thanks.
2 Replies
- hoolio
Cirrostratus
You 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]" } } }
- Craig_Hoss_1781
Nimbostratus
I will give this a try.
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