Cisco CSS 11500 Series Content Services Switches

Configuring CSS 11000 and 11500 Products to Stick Clients to a Server Based on Cookies

Document ID: 12576

Updated: Jan 31, 2006



This document demonstrates the use of the advanced-balance cookie content rule function. Advanced-balance cookie allows the Content Services Switch (CSS) to make its load balancing decision based on a cookie sent by a real server. If you know in advance what type of information the cookie contains, however, you can use this information to tell the CSS how to perform its loadbalancing decision.

Note: The CSS cannot learn the cookie from the server, and stick every request that would include this cookie to the same server.

Before You Begin


For more information on document conventions, see the Cisco Technical Tips Conventions.


There are no specific prerequisites for this document.

Components Used

The information in this document is based on all Cisco CSS 11000 and 11500 Series CSSs running Cisco WebNS Software Release 3.0 and later.

The information presented in this document was created from devices in a specific lab environment. All the devices used in this document started with a cleared (default) configuration. If you are working in a live network, ensure that you understand the potential impact of any command before using it.


In this section, you are presented with the information to configure the features described in this document.

Configuring the Content Switch

When configuring the CSS 11000 and 11500, determine first if you need a server cookie string. If the string operation under the content rule is match-service-cookie, which is the default setting, this parameter must be configured. In this case the service cookie string is matched against the cookie contained in the HTTP header for load balancing decision.

If the string operation under the content rule is set to the hash method, this parameter is not needed. In order to select one of the available servers, the cookie contained in the HTTP header is mathematically processed using a hashing algorithm. If available, the hash algorithm assigna the connection carrying a certain cookie to the same server. This example focuses on the match-service-cookie case.

Note: Cookies are case sensitive.

Configuring the Service

training4(config># service server_g
training4(config-service[server_g])# string LV2KJK (the server cookie text)
training4(config># service server_h
training4(config-service[server_h])# string AARIKA

Configuring the Content Rule

Note: Cookies require a Layer 5 rule. You can create a Layer 5 rule by adding a URL. For example, <url"/*">. A Layer 4 rule can be promoted to a Layer 5 rule by issuing the advanced-balance cookies command.

  1. Choose the advanced-balance method.

    training4(config-owner-content[cookie-layer5])# advanced-balance cookies
  2. Configure the string operation.

    training4(config-owner-content[cookie-layer5])# string operation ?
    match-service-cookie (DEFAULT)
  3. Define the starting/ending bytes.

    training4(config-owner-content[cookie-layer5])# string range 1 to 200
     Start byte position of cookie/url after header (Range:1-600)
  4. Specify the prefix located in the string range.

    training4(config-owner-content[cookie-layer5])# string prefix "ASPSESSION"
    <quoted text>"Quoted textual information"(Len: 0-32)
  5. Indicate how many bytes to skip after the starting prefix.

    training4(config-owner-content[cookie-layer5])# string skip-length 9
    <quoted text>"Quoted textual information"(Len: 0-32)
  6. Indicate how many bytes after the prefix/skip-length make-up the string.

    training4(config-owner-content[cookie-layer5])# string process-length 6
    <integer>Integer value(Range: 0-64)
  7. If no string process length is configured, search after end of string character.

    training4(config-owner-content[cookie-layer5])# string eos-char "&"
    <quoted text>"Quoted textual information"(Len: 0-5)
  8. Specify the failover in the event that a server goes down or is suspended.

    training4(config-owner-content[cookie-layer5])# sticky-serverdown-failoversticky-srcip
    balance (Default)

Below is an example of a cookie string, and how some of the parameters work.


!--- The string prefix = ASPSESSION.

!--- The string skip-length = 9. Skip 
!--- nine characters after the prefix. 

!--- The string process-length = 6, which would make 
!--- the string LV2KJK matching service server_g.


!--- Matches service server_h.

Below is a sample configuration for the cookie strings.

!************************** SERVICE **************************
service server_g 
  ip address 
  string LV2KJK 

service server_h 
  ip address 
  string AARIKA 

!*************************** OWNER ***************************
owner braden 

  content server-cookie 
    protocol tcp 
    vip address 
    port 80 
    advanced-balance cookies 
    string range 1 to 200 
    string prefix "ASPSESSION" 
    string skip-length 9 
    string process-length 6 
    add service server_g 
    add service server_h 


There is currently no verification procedure available for this configuration.


There is currently no specific troubleshooting information available for this configuration.

Related Information

Updated: Jan 31, 2006
Document ID: 12576