...
Setting up AWCM persistence rules using F5 and Netscaler
Setting up AWCM persistence rules using F5 The following guide shows an example of an F5 LTM configuration of persistence settings for an AWCM deployment, but it could be very similar to other load-balancing appliances. The persistence settings are only necessary for AWCM servers that are load-balanced in an active-active manner. The persistence settings will ensure that established connections are not dropped when the F5 switches from one AWCM server to the other to balance the load. On-premises customers will need to configure their F5 to persist the HTTP requests to AWCM based on the value of a awcmsessionid cookie. The iRule might vary based on a client’s existing configuration or best-practices, but the basics are straight forward: Parse the HTTP request for the awcmsessionid cookie's valueSet persistence with this value via the “persist carp” command. For more background on this methodology, see the following F5 solution page for Overview of the CARP hash algorithm. Steps for adding a persistence profile for AWCM 1. Create an iRule to inspect the HTTP request for the value of the “awcmsessionid” cookie. when HTTP_REQUEST { if { ([string tolower [HTTP::uri]] contains "awcmsessionid=") }{ #log local0. "CARPHASH-iRULE START: http uri set to [HTTP::uri]" #pull the data from after the sessionid marker. set awcm_session_id [string range [HTTP::uri] [string first "awcmsessionid=" [HTTP::uri]] end] set awcm_session_id [string range $awcm_session_id 14 end] set sessionidlen [string length $awcm_session_id] #strip off any #-symbol at the end of the string to be ignored in the HASH function. if {$awcm_session_id contains "#"} { #log local0. "CARPHASH-iRULE: sessionid before trimright # -- $awcm_session_id" set awcm_session_id [string trimright $awcm_session_id #] #log local0. "CARPHASH-iRULE: sessionid after trimright # -- $awcm_session_id" } #log local0. "CARPHASH-iRULE: awcm_session_id from URI was set to $awcm_session_id with length of $sessionidlen" # If the awcmsessionid field was not the last variable in the uri and more ampersands exist # use only up to the first one and strip it out along with everything after it if { $awcm_session_id contains "&"}{ set awcm_session_id [string range $awcm_session_id 0 35] set sessionidlen [string length $awcm_session_id] #log local0. "CARPHASH-iRULE: awcm_session_id post ampersand was set to $awcm_session_id with length of $sessionidlen" } #Check if the session ID is blank so we don't persist on blank data if {$awcm_session_id != ""}{ #Use the carp hash persistence method with the session ID as the input for a 0 second interval persist carp $awcm_session_id #log local0. "CARPHASH-iRULE: carp persistence has been set for HTTP URI: $awcm_session_id" } } elseif { [HTTP::header exists "awcmsessionid"] } { set awcm_session_id [HTTP::header value awcmsessionid] set sessionidlen [string length $awcm_session_id] #log local0. "CARPHASH-iRULE: awcmsessionid from http header is $awcm_session_id with length of $sessionidlen" #Check if the session ID is blank so we don't persist on blank data if {$awcm_session_id != ""}{ #Use the carp hash persistence method with the session ID as the input for a 0 second interval persist carp $awcm_session_id #log local0. "CARPHASH-iRULE: carp persist has been set for HTTP Header: $awcm_session_id" } }} 2. Create a persistence profile based on the default “hash” profile. All items should be default except the following: Algorithm: “CARP”iRule: created in Step 1. 3. Configure the Virtual server with the following settings: Select an HTTP profile from the “HTTP Profile” drop-down. Select OneConnect profile (for HTTP request balancing, not just connection). Apply the persistence profile under the Resources tab. Example configuration for NetScaler load balancer NOTE: Below is the persistance rule for copy paste functionality.HTTP.REQ.COOKIE.VALUE("awcmsessionid") ALT HTTP.REQ.URL.AFTER_STR("?awcmsessionid=").BEFORE_STR("?") ALT HTTP.REQ.URL.AFTER_STR("?awcmsessionid=")