ADC

Configure a cache redirection policy

A cache redirection policy includes an expression (also called a rule). The expression represents a condition that is evaluated when the client request is compared to the policy.

You do not explicitly configure actions for cache redirection policies.

A cache redirection policy has a name and includes an Advanced policy expression, or a set of Advanced policy expression clauses that are combined by using logical operators, and the following built-in actions:

  • CACHE
  • ORIGIN

For more information about Advanced policy expressions, see Policies and Expressions.

Add a cache redirection policy by using the CLI

At the command prompt, type the following commands to add a cache redirection policy and verify the configuration:

-  add cr policy <policyName> **-rule** <expression> -action<string> [-logAction<string>]

-  show cr policy [<policyName>]

<!--NeedCopy-->

Examples:

Policy with a simple expression:

> add cr policy crpol1 -rule !(HTTP.REQ.URL.ENDSWITH(".jpeg")) -action origin
 Done
> show cr policy crpoll
    Policy: crpol1 Rule: !(HTTP.REQ.URL.ENDSWITH(".jpeg")) Action: ORIGIN
    Hits: 0
 Done

<!--NeedCopy-->

Policy with a compound expression:

> add cr policy crpol11 -rule 'http.req.method.eq(post) && (HTTP.REQ.URL.ENDSWITH(".gif") || HTTP.REQ.URL.ENDSWITH(".cgi"))'  -action cache
 Done
> show cr policy crpol11
    Policy: crpol11    Rule: http.req.method.eq(post) && (HTTP.REQ.URL.ENDSWITH(".gif") || HTTP.REQ.URL.ENDSWITH(".cgi"))  Action: CACHE
    Hits: 0
 Done

<!--NeedCopy-->

Policy that evaluates a header:

> add cr policy crpol12 -rule http.req.header("If-Modified-Since").exists -action origin
 Done
> show cr policy crpol12
    Policy: crpol12    Rule: http.req.header("If-Modified-Since").exists   Action: ORIGIN
    Hits: 0
 Done

<!--NeedCopy-->

Modify or remove a cache redirection policy by using the CLI

  • To modify a cache redirection policy, use the set cr policy command, which is just like add cr policy command, except that you enter the name of an existing policy and you only have to provide the parameters that you want to modify.
  • To remove a policy, use the rm cr policy command, which accepts only the <name> argument. If the policy is bound to a virtual server, you have to unbind the policy, before you can remove it.

For the details of unbinding a cache redirection policy, see Unbind a policy from a cache redirection virtual server.

Configure a cache redirection policy with a simple expression by using the GUI

  1. Navigate to Traffic Management > Cache Redirection > Policies.

  2. In the details pane, click Add.

  3. In the Create Cache Redirection Policy dialog box, in the Name text box, type the name of the policy.
  4. Select the appropriate action CACHE or ORIGIN from the Action drop-down list.
  5. In the Log Action area, click Add. Type a name in the Create Audit Message Action dialog box.
    • Configure Log Level by choosing the appropriate value from the drop-down list:

      • EMERGENCY
      • ALERT
      • CRITICAL
      • ERROR
      • WARNING
      • NOTICE
      • INFORMATIONAL
      • DEBUG
    • Enter the expression in the Expression area. Configure an advanced expression. For more information, see Policy Expressions.
    • Click Create.
  6. Configure the rule using the advanced expression. For more information see Policy Expressions.
  7. When you are finished entering the expression, click Create.

Cache redirection with simple expression

Configure a cache redirection policy