Forum Discussion
irule - check query parameter
Hi
I would like to check if specific query parameter (ids) in url is above some numeric value (300), if yes then redirect to specific page.
Sample https request: https://xyz.ab/some/path/additition?lang=en&ids=300
How to check if this parameter is only number and not string ?
Sample irule
WHEN HTTP_REQUEST {
if {[HTTP::uri] starts with "/some/path" and [URI::query [HTTP::uri] ids ] > 300 }
{ HTTP::redirect "https://xyz.ab/404.html" }
}
When i add some string to ids for example ids=300ab above irule also redirects so how to validate this query parameter so that if and only if it is a number and is above 300 it will redirect to specific page ?
- xuwenCumulonimbuswhen HTTP_REQUEST priority 500 {set ids [URI::query [HTTP::uri] ids]if { [HTTP::uri] starts_with "/some/path" && [catch { expr { int($ids) > 300 } } res] == 0 && $res == 1 } {}}
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