Forum Discussion
Oct 12, 2015
BIG-IP : iRule case-insensitive query-param matching
F5 BIG-IP Virtual Edition v11.4.1 (Build 635.0) LTM on ESXi
In my iRule I wish to identify the value of a query-param that may or may not be present.
I'm using this logic :
set myparam 0
s...
Hannes_Rapp
Oct 12, 2015Nimbostratus
Using your sample, you can conver it to lower-case, before using the variable for any string comparisons: set myparam [string tolower [URI::query [HTTP::uri] myparam]]
Alternatively:
set myparam [string tolower [HTTP::query]]
In case of a request www.asd.fgh/asd?fFF=1, the code above would return "fff=1" (without the query question mark).
if you want to include the query question mark, use the code below which will return "?fff=1"
set myparam "?[string tolower [HTTP::query]]"
- Oct 12, 2015thanks Hannes but your understanding of the URI::query function does not match my own. My understanding is that 'URI::query uri-string query-param-name' returns 1 if "query-param-name=x" ( irrelevant of value of x ) is present in uri-string, and 0 if it's not.
- Hannes_RappOct 12, 2015NimbostratusNo, this understanding is not correct. This function will return the value of query parameter, the exact value present in place of x in your sample, not a binary result (0 or 1). If you want a binary result, why not try 'if {[string tolower [HTTP::query]] contains "myparameter"}{ set RESULT 1 }'
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