Forum Discussion
Brian_Gupta_115
Nimbostratus
Jan 27, 2005Need a sanity check on a URI parsing rule...
when HTTP_REQUEST {
set my_uri [string tolower [HTTP::uri]]
if { $my_uri contains "/hr" or $my_uri starts_with "hr" } {
pool hrmstest
} elseif { $my_uri contains "/selfservice" or $my_uri starts_with "selfservice" } {
pool hrmstest
} elseif { $my_uri contains "/fi" or $my_uri starts_with "fi" } {
pool fintest
} elseif { $my_uri contains "/fd" or $my_uri starts_with "fd" } {
pool fintest
} elseif { $my_uri contains "/ofi" or $my_uri starts_with "ofi" } {
pool fintest
} elseif { $my_uri contains "/cr" or $my_uri starts_with "cr" } {
pool crmtest
} else { pool fintest }
}
I am going to use "hr" test as the example of what I am trying to accomplish.
For the following URLs I want to use pool hrmstest:
https://pstest2.timeinc.com/psp/SELFSERVICE/?cmd=login
https://pstest2.timeinc.com/selfservice
https://pstest2.timeinc.com/psp/SELFSERVICE/EMPLOYEE/HRMS/h/?tab=DEFAULT
https://pstest2.timeinc.com/hrtest
https://pstest2.timeinc.com/hr
https://pstest2.timeinc.com/psp/HR/?cmd=login
https://pstest2.timeinc.com/hrdmo88
https://pstest2.timeinc.com/HRIPC
https://pstest2.timeinc.com/HRUPG
https://pstest2.timeinc.com/HRIPC2
https://pstest2.timeinc.com/psp/hrdm88s1
https://pstest2.timeinc.com/HRTEST
https://pstest2.timeinc.com/HRDEV
https://pstest2.timeinc.com/HRRAC1
https://pstest2.timeinc.com/HRSNG
Will my rule accomplish this? And is there a more efficient way to accomplish this?
Finally I need to use cookie persistence. Can I just use a profile in combination with this rule or will I need to extend my rule to cover persistence?
- bl0ndie_127134Historic F5 AccountBrian using match class might simplifiy your rule. Here is an example.
class hrmstest_uris { "/psp/SELFSERVICE/?cmd=login" "/selfservice" "/psp/SELFSERVICE/EMPLOYEE/HRMS/h/?tab=DEFAULT" "/hrtest" "/hr" "/psp/HR/?cmd=login" "/hrdmo88" } when HTTP_REQUEST { if { [matchclass [HTTP::uri] equals $::hrmstest_uris] } { use pool hrmstest } else { use pool fintest } }
- unRuleY_95363Historic F5 AccountYou may also use multiple classes to partition your pool matching.
class hrmstest_uris { "/hrtest" "/hr" "/psp/HR" } class crtest_uris { "/cr" }
when HTTP_REQUEST { if { [matchclass [HTTP::uri] starts_with $::hrmstest_uris] } { pool hrmstest } elseif { [matchclass [HTTP::uri] starts_with $::crtest_uris] } { pool crtest } else { pool fintest } }
- unRuleY_95363Historic F5 Account
- Brian_Gupta_115
Nimbostratus
I setup the classes. For one of the pools I needed to use serverssl. I enabled serverssl on the pool and made this rule:when HTTP_REQUEST { set my_uri [string tolower [HTTP::uri]] set usessl 0 if { [matchclass $my_uri contains $::ps_hrms_uris] } { pool hrmstest } elseif { [matchclass $my_uri contains $::ps_fin_uris] } { pool fintestssl set usessl 1 } elseif { [matchclass $my_uri contains $::ps_crm_uris] } { pool crmtest } else { pool portaltest } } when SERVER_CONNECTED { if { $usessl == 0 } { SSL::disable } }
- unRuleY_95363Historic F5 AccountThat looks great!
- Brian_Gupta_115
Nimbostratus
Quick question regarding TCL Boolean. Is 0 or 1 = true? - When TCL convers expressions to a boolean value (which is the same for every other language I know), zero is false and non-zero is true.
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