Posted by jmaddox
What is the correct syntax to prevent the error indicating that “elseif” is unknown command?
when RULE_INIT { # List of “part of URL” not autho “redacted”] set cookie_name “ua_lbdev_node_forced” } when HTTP_REQUEST { # Get node number from URL ending in /?node1, /?node2, etc. set node_forced [findstr [HTTP::uri] “?node” 5] # Or from previous cookie set has_cookie [HTTP::cookie exists $::cookie_name] if { $node_forced eq “” and $has_cookie } { set node_forced [HTTP::cookie value $::cookie_name] } # Map node number to IP and port found in a class if { $node_forced ne “” } { set node_data [ $node_forced index $::testelearning_nodes " "] if { $node_data ne “” } { set node_ip [getfield $node_data " " 1] set node_port [getfield $node_data " " 2] pool vista_test_http_pool member $node_ip $node_port } else { set node_forced “” } } } when HTTP_RESPONSE { if { $node_forced ne “” } { # Add a cookie to continue forcing node assignment HTTP::cookie insert name $::cookie_name value $node_forced path “/” } elseif { $has_cookie } { # Delete cookie and resume load balancing (with persistence) HTTP::cookie insert name $::cookie_name value “” path “/” HTTP::cookie expires $::cookie_name 0 absolute } }