Thanks for the quick reply!
This is how the rule looks now.
when HTTP_REQUEST {
Log the request details and class contents. Need to use $:: to reference the class name here.
log local0. "[IP::client_addr]:[TCP::client_port]: [HTTP::method] to [HTTP::host][HTTP::uri]"
Check if the requested host is in the my_hosts_class datagroup
if { [matchclass [HTTP::host] equals my_hosts_class] } {
log local0. "[IP::client_addr]:[TCP::client_port]: Matched!"
HTTP::redirect http://[string map -nocase {"www" "my"} [HTTP::host]][HTTP::uri]
} else {
HTTP::respond 200 content " Sorry, no match "
log local0. "[IP::client_addr]:[TCP::client_port]: No match"
}
}
log:
11:42:10 tmm tmm[1144]: 01220001:3: TCL error: Rule VSred - Invalid matchclass operands - no class or list type found, lhs: string, rhs: my_hosts_class (line 4) invoked from within "matchclass [HTTP::host] equals my_hosts_class"
Feb 25 11:42:31 tmm tmm[1144]: Rule VSred : 157.130.44.166:20463: GET to
www.my.domain.com/
Feb 25 11:42:31 tmm tmm[1144]: 01220001:3: TCL error: Rule VSred - Invalid matchclass operands - no class or list type found, lhs: string, rhs: my_hosts_class (line 4) invoked from within "matchclass [HTTP::host] equals my_hosts_class"
Feb 25 11:42:36 tmm tmm[1144]: Rule VSred : 157.130.44.166:20585: GET to
www.my.domain.com/
Feb 25 11:42:36 tmm tmm[1144]: 01220001:3: TCL error: Rule VSred - Invalid matchclass operands - no class or list type found, lhs: string, rhs: my_hosts_class (line 4) invoked from within "matchclass [HTTP::host] equals my_hosts_class"