Forum Discussion
Mario
Nimbostratus
Oct 26, 2020verify the length of a value in the header
Currently I need an iRule that verifies the amount of characters that a field has in the header, if a cell phone number arrives (10 digits) it is redirected to a VS, but if a land line number arrives...
jaikumar_f5
Noctilucent
Nov 04, 2020Here's what you can do, I've tested it, able to capture it fine.
set digits [findstr [HTTP::payload] "<singleValue>" 13 "<"]
log local0. "$digits & legth is [string length $digits]"Payload:
<values>
<name>operatorUserId</name>
<singleValue>1234567809</singleValue>
</values> Output:
<HTTP_REQUEST>: 1234567809 & legth is 10Payload:
<values>
<name>operatorUserId</name>
<singleValue>1234567</singleValue>
</values> Output:
<HTTP_REQUEST>: 1234567 & legth is 7Now with the length value, you can either set it on a variable and do a if condition and send to respective virtual. Hope it helps.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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