Product Documentation

Configuring Content Switching Policies

Aug 22, 2013

A content switching policy defines a type of request that is to be directed to a load balancing virtual server. These policies are applied in the order of the priorities assigned to them or (if you are using NetScaler classic policies and do not assign priorities when binding them) in the order in which the policies were created.

The policies can be:

  • Domain-based policies. The NetScaler appliance compares the domain of an incoming URL with the domains specified in the policies. The appliance then returns the most appropriate content. Domain-based policies must be classic policies; default syntax policies are not supported for this type of content switching policy.
  • URL-based policies. The appliance compares an incoming URL with the URLs specified in the policies. The appliance then returns the most appropriate URL-based content, which is usually the longest matching configured URL. URL-based policies must be classic policies; default syntax policies are not supported for this type of content switching policy.
  • Rule-based policies. The appliance compares incoming data to expressions specified in the policies. You create rule-based policies by using either a classic expression or a default syntax expression. Both classic and default syntax policies are supported for rule-based content switching policies.

    Note: A rule based policy can be configured with an optional action. A policy with an action can be bound to multiple virtual servers or policy labels.

    If you set a priority when binding your policies to the content switching virtual server, the policies are evaluated in order of priority. If you do not set specific priorities when binding your policies, the policies are evaluated in the order in which they were created.

For information about NetScaler classic policies and expressions, see "Configuring Classic Policies and Expressions." For information about Default Syntax policies, see "Configuring Default Syntax Expressions."

To create a content switching policy by using the command line interface

At the command prompt, type one of the following commands:

  • add cs policy <policyName> -domain <domain>
  • add cs policy <policyName> -url <URLValue>
  • add cs policy <policyName> -rule <RULEValue>
  • add cs policy <policyName> -rule <RULEValue> -action <actionName>

Example

 
add cs policy Policy-CS-1 -url "/sports/*" 
 
add cs policy Policy-CS-1 -domain "example.com" 
 
add cs policy Policy-CS-1 -rule "CLIENT.IP.SRC.SUBNET(24).EQ(10.217.84.0)" 
 
add cs policy Policy-CS-2 -rule "SYS.TIME.BETWEEN(GMT 2009 Nov,GMT 2009 Dec)" 
 
add cs policy Policy-CS-3 -rule "http.req.method.eq(GET)" -action act1

To rename a content switching policy by using the command line interface

At the command prompt, type:

rename cs policy <policyName> <newName>

Example

 
rename cs policy myCSPolicy myCSPolicy1 

To rename a content switching policy by using the configuration utility

Navigate to Traffic Management > Content Switching > Policies, select a policy and, in the Action list, select Rename.

To create a content switching policy by using the configuration utility

Navigate to Traffic Management > Content Switching > Policies, and configure a content switching policy.