Forum Discussion
Dev_16_371257
Nimbostratus
Sep 05, 2018Need help In irule to execute condition based on URI Values
Hi Experts,
I am trying to write the I-rule where uri have 10digit numeric value and it should not contain any special character/alphabet , also the length of that numeric value is not more than 10...
youssef1
Cumulonimbus
Sep 05, 2018Hi Dev,
I write and tested this irule with success:
Your example: http://www.hostname.com/uripath/sn=1234567890/abouttoopenhomepage.docx
when HTTP_REQUEST {
set uri [string tolower [HTTP::uri]]
retrieve SN Value
set SN_value [findstr $uri /sn= 4 /]
log local0. "$SN_value"
define if SN_value is digit (catch error if not digit)
if { [catch {
regexp {^([0-9]+)$} $SN_value -> value
log local0. "cn value = $value is a digit"
set digit 1 } ] } {
set digit 0
log local0. "cn value is not only digit"
}
if {[string length $SN_value] == 10 && $digit == 1 && ($uri ends_with ".docx" || $uri ends_with ".xlsx")} {
log local0. "cn value is a digit and is lenght is not more than 10 and not less than 10 digit "
}
}
Keep me in touch and if you need more details don't hesitate.
regards
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