Forum Discussion
set string to lower case not working for query
I have the iRule below, and I am trying to match on keywords within a query to redirect users to a splash page, but the lowercase conversion is not working. Can someone tell me what may be wrong?
when HTTP_REQUEST {
HTTP::query [string tolower [HTTP::query]]
if {[HTTP::uri] contains "search/results.aspx" && ([HTTP::uri] contains "password" || [HTTP::uri] contains "pwd" || [HTTP::uri] contains "user" || [HTTP::uri] contains "usr" || [HTTP::uri] contains "passwd")
}
{
HTTP::redirect ""
}
}
1 Reply
- nitass
Employee
i understand HTTP::query does not set/change query part.
HTTP::query
https://devcentral.f5.com/wiki/iRules.http__query.ashx
so, can you try to set HTTP::uri to lowercase to variable and use it in comparision later?
e.g.[root@ve10:Active] config b rule myrule list rule myrule { when HTTP_REQUEST { log local0. "0: [HTTP::uri]" set uri [string tolower [HTTP::uri]] log local0. "1: $uri" } } [root@ve10:Active] config tail -f /var/log/ltm Jul 11 14:54:20 local/tmm info tmm[4950]: Rule myrule : 0: /test?ABC=1234 Jul 11 14:54:20 local/tmm info tmm[4950]: Rule myrule : 1: /test?abc=1234
just in case if you have not yet seen this note.
Notes
Beginning in version 11, the cached behavior changes so that the value of the uri is updated immediately after being set. Previously, you would need to log the value in a higher priority (read: higher number) of the current event or log the value in a later event in order to reflect the change.HTTP::uri
https://devcentral.f5.com/wiki/irules.http__uri.ashx
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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