Simplifying route irules
Is there anyway to simplify the following rules
Route traffic to server1 if URL listed in class_goto_server1
when HTTP_REQUEST {
set $HTTPuri [string tolower [HTTP::uri]]
URL starts_with check and Node select
if {[class match -name $HTTPuri starts_with class_toserver1_StartsWith]} {
pool server_1
}
URL equals check and Node select
class_toserver1_
if {[class match -name $HTTPuri equals Equals]} {
pool server1
}
}
The content of the external class file:
- class_toserver1_StartsWith
/s/
/staff/
/tax/
- class_toserver1_Equals
/s
/staff
/tax
The list is quite long ( about 500 lines )
The reason we have these 2 class match is because we want /staff/ to go to server1, but staff-profile to go to default server .
Im thinking of having just 1 class file and do the matching programatically using iRules. Is this possible and how ?