Binding a Rewrite Policy
After creating a rewrite policy, you must bind it to put it into effect. You can bind your policy to Global if you want to apply it to all traffic that passes through your Citrix ADC, or you can bind your policy to a specific virtual server or bind point to direct only that virtual server or bind point’s incoming traffic to that policy. If an incoming request matches a rewrite policy, the action associated with that policy is carried out.
Rewrite policies for evaluating HTTP requests and responses can be bound to virtual servers of type HTTP or SSL, or they can be bound to the REQ_OVERRIDE, REQ_DEFAULT, RES_OVERRIDE, and RES_DEFAULT bind points. Rewrite policies for TCP rewrite can be bound only to virtual servers of type TCP or SSL_TCP, or to the OTHERTCP_REQ_OVERRIDE, OTHERTCP_REQ_DEFAULT, OTHERTCP_RES_OVERRIDE, and OTHERTCP_RES_DEFAULT bind points.
Note: The term OTHERTCP is used in the context of the Citrix ADC appliance to refer to all TCP or SSL_TCP requests and responses that you want to treat as a raw stream of bytes regardless of the protocols that the TCP packets encapsulate.
When you bind a policy, you assign it a priority. The priority determines the order in which the policies you define are evaluated. You can set the priority to any positive integer.
In the Citrix ADC operating system, policy priorities work in reverse order - the higher the number, the lower the priority. For example, if you have three policies with priorities of 10, 100, and 1000, the policy assigned a priority of 10 is applied first, then the policy assigned a priority of 100, and finally the policy assigned an order of 1000.
Unlike most other features in the Citrix ADC operating system, the rewrite feature continues to evaluate and implement policies after a request matches a policy. However, the effect of a particular action policy on a request or response will often be different depending on whether it is performed before or after another action. Priority is important to get the results you intended.
You can leave yourself plenty of room to add other policies in any order, and still set them to evaluate in the order you want, by setting priorities with intervals of 50 or 100 between each policy when you bind it. If you do this, you can add additional policies at any time without having to reassign the priority of an existing policy.
When binding a rewrite policy, you also have the option of assigning a goto expression (gotoPriorityExpression) to the policy. A goto expression can be any positive integer that matches the priority assigned to a different policy that has a higher priority than the policy that contains the goto expression. If you assign a goto expression to a policy, and a request or response matches the policy, the Citrix ADC will immediately go to the policy whose priority matches the goto expression. It will skip over any policies with priority numbers that are lower than that of the current policy, but higher than the priority number of the goto expression, and not evaluate those policies.
To globally bind a rewrite policy by using the command line interface
At the command prompt, type the following commands to globally bind a rewrite policy and verify the configuration:
- bind rewrite global <policyName> <priority> [<gotoPriorityExpression>] [-type <type>] [-invoke (<labelType> <labelName>) ]
- show rewrite global
>bind rewrite global policyNew 10 Done > show rewrite global 1) Global bindpoint: RES_DEFAULT Number of bound policies: 1 2) Global bindpoint: REQ_OVERRIDE Number of bound policies: 1 Done
To bind rewrite policy to a specific virtual server by using the command line interface
At the command prompt, type the following commands to bind rewrite policy to a specific virtual server and verify the configuration:
bind lb vserver <name>@ (<serviceName>@ [-weight <positive_integer>]) <serviceGroupName>@ (-policyName <string>@ [-priority <positive_integer>] [-gotoPriorityExpression <expression>] [-type ( REQUEST RESPONSE )] [-invoke (<labelType> <labelName>) ] )
- show lb vserver <name>
> bind lb vserver lbvip -policyName ns_cmp_msapp -priority 50 Done > > show lb vserver lbvip lbvip (18.104.22.168:80) - HTTP Type: ADDRESS State: DOWN Last state change was at Wed Jul 15 05:54:24 2009 (+226 ms) Time since last state change: 28 days, 01:57:26.350 Effective State: DOWN Client Idle Timeout: 180 sec Down state flush: ENABLED Disable Primary Vserver On Down : DISABLED Port Rewrite : DISABLED No. of Bound Services : 0 (Total) 0 (Active) Configured Method: LEASTCONNECTION Mode: IP Persistence: NONE Vserver IP and Port insertion: OFF Push: DISABLED Push VServer: Push Multi Clients: NO Push Label Rule: none 1) Policy : ns_cmp_msapp Priority:50 2) Policy : cf-pol Priority:1 Inherited Done
To bind a rewrite policy to a bind point by using the configuration utility
- Navigate to AppExpert > Rewrite > Policies.
- In the details pane, select the rewrite policy you want to globally bind, and then click Policy Manager.
- In the Rewrite Policy Manager dialog box, in the Bind Points menu, do one of the following:
- If you want to configure bindings for HTTP rewrite policies, click HTTP, and then click either Request or Response, depending on whether you want to configure request-based rewrite policies or response-based rewrite policies.
- If you want to configure bindings for TCP rewrite policies, click TCP, and then click either Client or Server, depending on whether you want to configure client-side TCP rewrite policies or server-side TCP rewrite policies.
- Click the bind point to which you want to bind the rewrite policy. The Rewrite Policy Manager dialog box displays all the rewrite policies that are bound to the selected bind point.
- Click Insert Policy to insert a new row and display a drop-down list with all available, unbound rewrite policies.
- Click the policy you want to bind to the bind point. The policy is inserted into the list of rewrite policies bound to the bind point.
- In the Priority column, you can change the priority to any positive integer. For more information about this parameter, see priority in “Parameters for binding a rewrite policy.”
- If you want to skip over policies and go directly to a specific policy in the event that the current policy is matched, change the value in the Goto Expression column to equal the priority of the next policy to be applied.. For more information about this parameter, see gotoPriorityExpression in “Parameters for binding a rewrite policy.”
- To modify a policy, click the policy, and then click Modify Policy.
- To unbind a policy, click the policy, and then click Unbind Policy.
- To modify an action, in the Action column, click the action you want to modify, and then click Modify Action.
- To modify an invoke label, in the Invoke column, click the invoke label you want to modify, and then click Modify Invoke Label.
- To regenerate the priorities of all the policies that are bound to the bind point you are currently configuring, click Regenerate Priorities. The policies retain their existing priorities relative to the other policies, but the priorities are renumbered in multiples of ten.
- Click Apply Changes.
- Click Close. A message appears in the status bar, stating that the Policy has been configured successfully.
To bind a rewrite policy to a specific virtual server by using the configuration utility
- Navigate to Traffic Management > Load Balancing > Virtual Servers.
- In the details pane list of virtual servers, select the virtual server to which you want to bind the rewrite policy, and then click Open.
- In the Configure Virtual Server (Load Balancing) dialog box, select the Policies tab. All policies configured on your Citrix ADC appear on the list.
- Select the check box next to the name of the policy you want to bind to this virtual server.
- Click OK. A message appears in the status bar, stating that the Policy has been configured successfully.
Binding a Rewrite Policy
In this article
- To globally bind a rewrite policy by using the command line interface
- To bind rewrite policy to a specific virtual server by using the command line interface
- To bind a rewrite policy to a bind point by using the configuration utility
- To bind a rewrite policy to a specific virtual server by using the configuration utility