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 “?”}
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]"
}
}
}