ADC

Configure policies for content switching

You must create a content switching policy to identify specific types of content to be directed to one server or farm and identify other types of content to serve from another cache server or farm. For example, you can configure a policy to determine the location for image files with .gif and .jpeg extensions.

Before creating the content switching policy you must define a content switching action to describe which load balancing virtual server to select. This action is used in the content switching policy.

After defining the content switching policy, you bind it to a content switching virtual server and specify a load balancing virtual server. Requests that match the policy are forwarded to the named load balancing virtual server. Requests that do not match the content switching policy are forwarded to the default load balancing virtual server for the cache.

For more details about the content switching feature and configuring content switching policies, see Content switching.

You must first create the content switching policy and then bind it to the content switching virtual server.

Create a content switching policy by using the command CLI

At the command line, type:

-  add cs action <name> [-targetLBVserver <string> | -targetVserver <string> | -targetVserverExpr <expression>]
-  add cs policy <policyName> -rule <expression> [-action <string>]
-  show cs policy [<policyName>]

<!--NeedCopy-->

Examples:

> add cs action action-CS-JPEG -targetLBVserver lbcachejpeg
Done
> show cs action action-CS-JPEG
    Name: action-CS-JPEG
    Target LB Vserver: lbcachejpeg
    Hits: 0
    Undef Hits: 0
    Action Reference Count: 0
Done

> add cs policy policy-CS-JPEG -rule 'HTTP.REQ.URL.SUFFIX == "jpeg"' - action action-CS-JPEG
Done
> show cs policy policy-CS-JPEG
    Policy: policy-CS-JPEG Rule: HTTP.REQ.URL.SUFFIX == "jpeg"
    Action: action-CS-JPEG

    HITS: 0
Done
>

> add cs action action-CS-GIF -targetLBVserver lbcachegif
Done
> show cs action action-CS-GIF
    Name: action-CS-GIF
    Target LB Vserver: lbcachegif
    Hits: 0
    Undef Hits: 0
    Action Reference Count: 0

Done
>
> add cs policy policy-CS-GIF -rule 'HTTP.REQ.URL.SUFFIX == "gif"' -action action-CS-GIF
Done
> show cs policy policy-CS-GIF
    Policy: policy-CS-GIF Rule: HTTP.REQ.URL.SUFFIX == "gif"
    Action: action-CS-GIF

    Hits: 0
Done
<!--NeedCopy-->

Create a rule-based content switching policy by using the GUI

  1. Navigate to Traffic Management > Content Switching > Policies.
  2. In the details pane, click Add.
  3. In the Create Content Switching Policy dialog box, in the Name text box, type a name for the policy.
  4. Click Add in the Action tab to create a content switch action. Or select the available action from the drop-down list.
    • Type a name for the content switch action in the Name tab.
    • Choose the virtual server or Expression from the drop-down list:
      • Loadbalancing Virtual Server
      • Global Server Loadbalancing Virtual Server
      • Authentication Virtual Server
      • NetScalar Gateway Virtual Server
      • Expression
    • Click Add or Edit to configure the Target Load Balancing Virtual Server.
  5. Click Add in the Log Action tab to create an audit message action. Or select the available audit message action from the drop-down list.
  6. In the Expression area, select the required type of expression.
  7. In the Expression Editor dialog box, choose the expression syntax that you want to use.

    In the Expression area click Evaluate to evaluate an expression evaluator. The evaluator evaluates the expression that you entered, to verify that it is valid, and displays an analysis of the expression’s effect in the Result area.

  8. Enter your policy expressions.

    For information about using the advanced syntax, see Configure advanced policy expression: Get started.

  9. Click Create. The policy you created appears in the Content Switching Policies pane.

Bind the content switching policy to a cache redirection virtual server by using the CLI

At the command prompt, type the following commands to bind the content switching policy to a cache redirection virtual server and verify the configuration:

-  bind cs vserver <name> (-lbvserver <string> | -vServer <string> (-policyName <string> [-targetLBVserver <string>] [-priority<positive_integer>] [-gotoPriorityExpression <expression>] [-type <type>] [-invoke (<labelType> <labelName>) ] )

-  show cs vserver [<name>]
<!--NeedCopy-->

Example:

> bind cs vserver Vserver-CR-1 -policyName Policy-CS-JPEG -priority 100
 Done
> bind cs vserver Vserver-CR-1 -policyName Policy-CS-GIF -priority 200
 Done
> show cs vserver Vserver-CR-1
        Vserver-CR-1 (10.102.29.60:80) - HTTP   Type: CONTENT
        State: UP
        Last state change was at Fri Jul  2 12:53:45 2010
        Time since last state change: 0 days, 00:00:58.920
        Client Idle Timeout: 180 sec
        Down state flush: ENABLED
        Disable Primary Vserver On Down : DISABLED
        Appflow loggig: ENABLED
        Port Rewrite : DISABLED
        State Update: DISABLED
        Default:        Content Precedence: RULE
        Cacheable: YES
        Vserver IP and Port insertion: OFF
        L2Conn: OFF    Case Sensitivity: ON
        Authentication: OFF
        401 Based Authentication: OFF
        Push: DISABLED  Push VServer:
        Push Label Rule: none
        HTTP Redirect Port: 0    Dtls:  OFF
        Persistence: NONE
        Listen Policy: NONE
        IcmpResponse: PASSIVE
        RHIstate: PASSIVE
        Traffic Domain:  0

1)      Content-Switching Policy: Policy-CS-JPEG Priority: 100     Hits: 0
2)      Content-Switching Policy: Policy-CS-GIF Priority: 200     Hits: 0
 Done
>
<!--NeedCopy-->

Bind the content switching policy to a cache redirection virtual server by using the GUI

  1. Navigate to Traffic Management > Content Switching > Virtual Servers.

  2. In the details pane, select the virtual server for which you want to bind the policy (for example, Vserver-CS-1), and then click Edit.
  3. In the Content Switching Virtual Server dialog box, on the Policies tab under Advanced Settings, click Add icon, and then choose policy and choose type from Choose Policy and Choose Type drop-down list.
  4. Click Continue.
  5. In the Policy Binding tab, select the available policies from the list and then click Select or click Add to create a new policy and then click Create.
  6. Click Bind to bind the content switching policy to the virtual server.
  7. Click Done
Configure policies for content switching