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 { ...
Ryan_Paras_7933
Jul 07, 2011Nimbostratus
Similar to spark's second snippet of code, if you are looking only one directory level deep you can do the following:
when HTTP_REQUEST {
set HTTPtopdir [lindex [split [string tolower [HTTP::uri]] /] 1]
if {[class match $HTTPtopdir equals class_toserver1]}
{
pool server1
}
}
This takes URI "/xxx/yyy/zzz" and sets HTTPtopdir to just "xxx". It then does a class match against a class looking to match "xxx".
This would allow you to have a simpler class definition, such as:
class class_toserver1 {
{
"s"
"staff"
"tax"
}
}
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