Forum Discussion
iRule Checking for No Value
Hi All,
Just want to check with the fellow community members if you all have any idea on how to use iRules to check for no value?
Basically, I am crafting an iRule that search for all headers and sieving out that it starts with sec-ch. If it starts with sec-ch and there isn't any value (tried playing around and this is not an empty string), how do i use iRules to check it as an if condition?
if {$header_name eq ????}, where ???? represents no value. Do assist if possible and share your experiences 😄
local0. goes to the LTM log:
tail -f /var/log/ltm
- Kevin_StewartEmployee
Something like this maybe:
when HTTP_REQUEST { foreach x [string tolower [HTTP::header names]] { if { ( $x starts_with "sec-ch" ) and ( [HTTP::header $x] eq "" ) } { log local0. "found empty sec-ch header" } } }
- BunnyJunJunAltostratus
Hi Kevin,
Thanks! I did roughly the same, however, in your context, x has no value. It is not even a string. Hence, quite hard for me to further "manipulate" x.
I was thinking to concatenate it like those we do for typical coding. (i.e. var temp = "" + x, and temp will be a string with x valueless). Is this possible in terms of iRules?
- Kevin_StewartEmployee
x is the header name. Are you saying the header doesn't exist?
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