Hi User1115,
For debugging you can do the following:
This is for version 9.x.x
when HTTP_REQUEST {
Insert cookie if it matches the CLASS_IP datagroup
if { [matchclass [IP::client_addr] eq $::class_ip] } {
HTTP::cookie insert name "class" value "class"
log local0. "The Source IP: [IP::client_addr] matched. Inserting Cookie"
}
Choose a pool based on URI
if { [HTTP::uri] starts_with "/clasee*"} {
log local0. "The URL is [HTTP::uri] which is selecting pool class"
pool class
} else {
log local0. "the URL is [HTTP::uri] which is selecting pool main"
pool main
}
}
OR Using a switch statement
when HTTP_REQUEST {
Insert cookie if it matches the CLASS_IP datagroup
if { [matchclass [IP::client_addr] eq $::class_ip] } {
log local0. "The Source IP: [IP::client_addr] matched. Inserting Cookie"
HTTP::cookie insert name "class" value "class"
}
Choose a pool based on URI
switch -glob [string tolower [HTTP::uri]] {
"/clasee*" {
pool class
log local0. "The URL is [HTTP::uri] which is selecting pool class"
}
default {
pool main
log local0. "the URL is [HTTP::uri] which is selecting pool main"
}
}
}
If you are going to v10 then the code would like like the following
when HTTP_REQUEST {
Insert cookie if it matches the CLASS_IP datagroup
if { [class match [IP::client_addr] equals "class_ip" } {
HTTP::cookie insert name "class" value "class"
log local0. "The Source IP: [IP::client_addr] matched. Inserting Cookie"
}
Choose a pool based on URI
if { [HTTP::uri] starts_with "/clasee*"} {
pool class
log local0. "The URL is [HTTP::uri] which is selecting pool class"
} else {
pool main
log local0. "the URL is [HTTP::uri] which is selecting pool main"
}
}
OR Using a switch statement for v10
when HTTP_REQUEST {
Insert cookie if it matches the CLASS_IP datagroup
if { [class match [IP::client_addr] equals "class_ip"] } {
HTTP::cookie insert name "class" value "class"
log local0. "The Source IP: [IP::client_addr] matched. Inserting Cookie"
}
Choose a pool based on URI
switch -glob [string tolower [HTTP::uri]] {
"/clasee*" {
pool class
log local0. "The URL is [HTTP::uri] which is selecting pool class"
}
default {
pool main
log local0. "the URL is [HTTP::uri] which is selecting pool main"
}
}
}
I hope this helps
Bhattman