Forum Discussion
iRule for ignoring request if it includes a specific parameter value
We currently have an iRule that is examining cookies to block or allow the request. We would also like to add a section that looks for a parameter's value. The parameter needs to equal "true" for it to pass. Below is a sample url and what we currently have as the iRule but it doesn't seem to be working:
https://www.site.com/path/location?xyz=abc&value=true&zzz=aaa
if { [HTTP::uri] starts_with "/path/" }
{
if { ![HTTP::query] contains "value=true" }
{
blocking action
}
else
{
ignoring action
}
}
}
Is there something we are missing or need to change for this to work? Thank you!
- Leonardo_SouzaCirrocumulus
Use the URI::query instead of HTTP::query.
This page explains what is, and has examples in how to use:
https://devcentral.f5.com/wiki/iRules.URI__query.ashx
Should be something like this (not tested iRule):
when HTTP_REQUEST { if { [HTTP::path] starts_with "/path/" } { if { [URI::query [HTTP::uri] "value"] ne "true" } { blocking action } else { ignoring action } } }
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