Forum Discussion
David_Windeyer
May 25, 2011Nimbostratus
help with using class match
I'm trying to write an I rule which will direct traffic to certain pools and nodes based on the host name.
The line with class match seems to be causing problems - complains about wanting braces. I tried following the example from http://devcentral.f5.com/wiki/defau...class.html
Does anyone have thoughts?
Thanks,
David.
when RULE_INIT {
Log debug messages to /var/log/ltm? (0=no, 1=yes)
set ::silo_access_debug 1
if {$::silo_access_debug}{log local0. "Debug set to $::silo_access_debug"}
}
when HTTP_REQUEST {
set app_pool_member [class match –value [HTTP::host] equals silo_access]
set app_pool [getfield $app_pool_member " " 1]
set app_member [getfield $app_pool_member " " 2]
if {$app_pool ne ""} {
if { $::silo_access_debug } { log local0. "[IP::client_addr] wants [HTTP::host], sending to pool $app_pool member $app_member" }
pool $app_pool member $app_member
}
}
- hooleylistCirrostratusHi David,
- hooleylistCirrostratusAlso, you can change the global variable in RULE_INIT to a static variable to preserve CMP:
when RULE_INIT { Log debug messages to /var/log/ltm? (0=no, 1=yes) set static::silo_access_debug 1 if {$static::silo_access_debug}{log local0. "Debug set to $static::silo_access_debug"} } when HTTP_REQUEST { set app_pool_member [class match -value [HTTP::host] equals silo_access] set app_pool [getfield $app_pool_member " " 1] set app_member [getfield $app_pool_member " " 2] if {$app_pool ne ""} { if { $static::silo_access_debug } { log local0. "[IP::client_addr] wants [HTTP::host], sending to pool $app_pool member $app_member" } pool $app_pool member $app_member } }
- David_WindeyerNimbostratusThanks for your help Aaron. This fixed the problem.
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