Forum Discussion
_pre_
Jul 06, 2011Nimbostratus
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 { ...
hooleylist
Jul 06, 2011Cirrostratus
Anything else I can think of would require looping through the datagroup element by element. I think what you've got is probably the most efficient even if it's a bit inelegant to have nearly duplicate entries in two separate datagroups.
You should move the second lookup into an elseif clause to avoid doing a second lookup if the first one matched. Or you could put it in one if clause with an ||. But I think elseif might be a bit more legible.
You could remove the -name option from both class commands as you're not doing anything with the matching element.
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 $HTTPuri starts_with class_toserver1_StartsWith]} {
pool server_1
} elseif {[class match $HTTPuri equals class_toserver1_Equals]} {
pool server1
}
}
Aaron
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