Hm. I think you actually could do a bit better. How about something like:
when HTTP_REQUEST {
set HTTPuri "[string tolower [HTTP::uri]]/"
URL starts_with check and Node select
if {[class match $HTTPuri starts_with class_toserver1_StartsWith]} {
pool server_1
}
}
Basically, always append a "/" character to the URI and then just do a "starts_with" search. If the URI is already "/staff-profile/" (or even "/staff-profile"), then that won't start with "/staff/", so it won't match that class entry. That way you're only doing one class lookup, and only have to maintain the one class.
If all of your class entries are only one directory level deep, then you can do even better than that:
when HTTP_REQUEST {
set HTTPtopdir "/[getfield [string tolower [HTTP::uri]] "/" 2]/"
top directory equals check and Node select
if {[class match $HTTPtopdir equals class_toserver1_equals]} {
pool server_1
}
}
That second example assumes the entries in class_toserver1_equals all end with slashes (meaning, "/staff/", and not "/staff").