Forum Discussion
Jeff_Morrison_4
Nimbostratus
Feb 15, 2006Too iRule???
F5 support suggested that I post my iRule on Devcentral as they felt there were issues with the iRule. Support felt it was to long and that there might be a better solution.
The purpose of ...
Feb 15, 2006
Or... If you wanted to step on the wild side, you could play some fun and games with string manipulation.
Assuming your uri always starts with "/Custxx" where xx is a number, then Something like this would be much more optimal.
when HTTP_REQUEST {
Parsing uri of the format /Custxx/path
set error 1
if { [HTTP::uri] starts_with "/Cust" } {
Set ranges for old and new uris
set LOW_RANGE_OLD 1
set HIGH_RANGE_OLD 57
set LOW_RANGE_NEW 58
set HIGH_RANGE_NEW 58
extract characters 5 to end from uri
ie. xx/path
set cust_num [string range [HTTP::uri] 5 end]
Search for possible slash separator in uri
set slash [string first "/" $cust_num]
if { -1 != $slash } {
Slash found so extract all characters up until the slash
incr slash -1
set cust_num [string range $cust_num 0 $slash]
}
Account for the case of the uri formatted as "/Cust"
if { "" ne $cust_num } {
Search range of old customer numbers
New customer numbers, and customer singles
if { ($cust_num >= $LOW_RANGE_OLD) && ($cust_num <= $HIGH_RANGE_OLD) } {
set error 0
pool Pool1
} elseif { ($cust_num >= $LOW_RANGE_NEW) && ($cust_num <= $HIGH_RANGE_NEW) } {
set error 0
pool Pool2
} elseif { $cust_num == 59 } {
set error 0
HTTP::redirect https://www.somewebsite.com/
}
}
}
if { 1 == $error } {
HTTP::redirect http://www.somewebsite.com/Error.html
}
}*Disclaimer, this rule has not been tested. Also, moving forward, since it was unclear from your initial post what you do with the customer numbers when they move forward you may either need to special cast them (if they go to different uris) or group them in a range.
If you special case them, then I'd recommend putting them in a string data group and using the findclass method to extract the target paths.
Good luck!
-Joe
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