Redirect URIs in datagroup to dedicated node
Hi
Could you help identify why I get the following error below when applying this irule.
ERROR =====================================
:9: error: ["wrong # of arguments"][class match -value $request_uri equals_any -case_sensitive [class lookup $datagroup_name]]
The aim is to send specific requests to a dedicated node "1.2.2.2" in pool "myprodpool" that match a URI list datagroup "ACL_webforms" . This must also maintain sticky persistence cookie on this node. So when request that contain URIs in datagroup, send to node 1.2.2.2 with cookie persistence
The irule below gives this error
set is_match [class match -value $request_uri equals_any -case_sensitive [class lookup $datagroup_name]]
IRULE ==============================
when HTTP_REQUEST {
# Define the name of your data group containing the URIs
set datagroup_name "ACL_Intranett-webforms"
# Get the request URI
set request_uri [HTTP::uri]
# Check if the request URI matches any entry in the data group
set is_match [class match -value $request_uri equals_any -case_sensitive [class lookup $datagroup_name]]
if { $is_match } {
# Set the node to your specific IP address
set node_ip "1.2.2.2"
# Set the persistence cookie name
set persistence_cookie_name "sticky_cookie_name"
# Check if the persistence cookie exists
set cookie_value [HTTP::cookie $persistence_cookie_name]
if { $cookie_value eq "" } {
# If the cookie doesn't exist, create and set the cookie
set cookie_value [IP::client_addr]
HTTP::cookie insert $persistence_cookie_name $cookie_value
}
# Set the persistence based on the cookie
persist uie cookie $persistence_cookie_name
pool $node_ip
return
}
}