ADC

Configuring a Rewrite Policy

After you create any needed rewrite action(s), you must create at least one rewrite policy to select the requests that you want the Citrix ADC appliance to rewrite.

A rewrite policy consists of a rule, which itself consists of one or more expressions, and an associated action that is performed if a request or response matches the rule. Policy rules for evaluating HTTP requests and responses can be based on almost any part of a request or response.

Even though you cannot use TCP rewrite actions to rewrite data other than the TCP payload, you can base the policy rules for TCP rewrite policies on the information in the transport layer and the layers below the transport layer.

If a configured rule matches a request or response, the corresponding policy is triggered and the action associated with it is carried out.

Note: You can use either the command line interface or the configuration utility to create and configure rewrite policies. Users who are not thoroughly familiar with the command line interface and the Citrix ADC Policy expression language will usually find using the configuration utility much easier.

To add a new rewrite policy by using the command line interface

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

  • []

Example 1. Rewriting HTTP Content:

> add rewrite policy policyNew "HTTP.RES.IS_VALID" insertact NOREWRITE Done > show rewrite policy policyNew Name: policyNew Rule: HTTP.RES.IS_VALID RewriteAction: insertact UndefAction: NOREWRITE Hits: 0 Undef Hits: 0 Done 

Example 2. Rewriting a TCP Payload (TCP Rewrite):

>添加重写策略client_tcp_payload_policy CLIENT.IP.SRC.EQ(172.168.12.232) client_tcp_payload_replace_all Done > show rewrite policy client_tcp_payload_policy Name: client_tcp_payload_policy Rule: CLIENT.IP.SRC.EQ(172.168.12.232) RewriteAction: client_tcp_payload_replace_all UndefAction: Use Global LogAction: Use Global Hits: 0 Undef Hits: 0 Done > 

To modify an existing rewrite policy by using the command line interface

At the command prompt, type the following commands to modify an existing rewrite policy and verify the configuration:

  • -rule -action []

Example:

> set rewrite policy policyNew -rule "HTTP.RES.IS_VALID" -action insertaction Done > show rewrite policy policyNew Name: policyNew Rule: HTTP.RES.IS_VALID RewriteAction: insertaction UndefAction: NOREWRITE Hits: 0 Undef Hits: 0 Done 

To remove a rewrite policy by using the command line interface

At the command prompt, type the following command to remove a rewrite policy:

rm rewrite policy

Example:

> rm rewrite policy policyNew Done 

To configure a rewrite policy by using the configuration utility

  1. Rewrite > Policies.