Forum Discussion
iRule Checking for No Value
- Oct 27, 2022
local0. goes to the LTM log:
tail -f /var/log/ltm
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"
}
}
}
- BunnyJunJunSep 27, 2022Altostratus
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_StewartSep 27, 2022Employee
x is the header name. Are you saying the header doesn't exist?
- BunnyJunJunSep 28, 2022Altostratus
Hi Kevin,
Header exist. An example of the request captured would be as such.
Header A: valueA
Header B: valueB
sec-ch-mobile:
Header C: valueCGiven the idea of above, sec-ch-mobile has no value and it is not an empty string. As such, how do i check for x is an empty value given your sample iRules above?
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