Product Documentation

rewrite policy

Sep 12, 2016

The following operations can be performed on "rewrite policy":

add | rm | set | unset | show | stat | rename

add rewrite policy

Creates a rewrite policy, which specifies which requests or responses to rewrite.

Synopsys

add rewrite policy <name> <rule> <action> [<undefAction>] [-comment <string>] [-logAction <string>]

Arguments

name

Name for the rewrite policy. Must begin with a letter, number, or the underscore character (_), and must contain only letters, numbers, and the hyphen (-), period (.) hash (#), space ( ), at (@), equals (=), colon (:), and underscore characters. Can be changed after the rewrite policy is added.

The following requirement applies only to the NetScaler CLI:

If the name includes one or more spaces, enclose the name in double or single quotation marks (for example, "my rewrite policy" or ?my rewrite policy?).

rule

Expression against which traffic is evaluated. Written in default syntax.

Note:

Maximum length of a string literal in the expression is 255 characters. A longer string can be split into smaller strings of up to 255 characters each, and the smaller strings concatenated with the + operator. For example, you can create a 500-character string as follows: '"<string of 255 characters>" + "<string of 245 characters>"'

(Classic expressions are not supported in the cluster build.)

The following requirements apply only to the NetScaler CLI:

* If the expression includes one or more spaces, enclose the entire expression in double quotation marks.

* If the expression itself includes double quotation marks, escape the quotations by using the \\ character.

* Alternatively, you can use single quotation marks to enclose the rule, in which case you do not have to escape the double quotation marks.

action

Name of the rewrite action to perform if the request or response matches this rewrite policy.

There are also some built-in actions which can be used. These are:

* NOREWRITE - Send the request from the client to the server or response from the server to the client without making any changes in the message.

* RESET - Resets the client connection by closing it. The client program, such as a browser, will handle this and may inform the user. The client may then resend the request if desired.

* DROP - Drop the request without sending a response to the user.

undefAction

Action to perform if the result of policy evaluation is undefined (UNDEF). An UNDEF event indicates an internal error condition. Only the above built-in actions can be used.

comment

Any comments to preserve information about this rewrite policy.

logAction

Name of messagelog action to use when a request matches this policy.

Example

i) add rewrite policy pol9 "HTTP.REQ.HEADER(\\\\"header\\\\").CONTAINS(\\\\"qh3\\\\")" act_insert ii) add rewrite policy pol9 "HTTP.REQ.HEADER(\\\\"header\\\\").CONTAINS(\\\\"qh3\\\\")" act_insert NOREWRITE iii) add rewrite policy pol9 "HTTP.REQ.HEADER(\\\\"header\\\\").CONTAINS(\\\\"qh3\\\\")" act_insert RESET iii) add rewrite policy pol9 "HTTP.REQ.HEADER(\\\\"header\\\\").CONTAINS(\\\\"qh3\\\\")" act_insert DROP

rm rewrite policy

Removes the specified rewrite policy.

Synopsys

rm rewrite policy <name>

Arguments

name

Name of the rewrite policy to be removed.

Example

rm rewrite policy pol9

set rewrite policy

Modifies the specified parameters of a rewrite policy.

Synopsys

set rewrite policy <name> [-rule <expression>] [-action <string>] [-undefAction <string>] [-comment <string>] [-logAction <string>]

Arguments

name

Name of the rewrite policy to modify.

rule

Expression against which traffic is evaluated. Written in default syntax.

Note:

Maximum length of a string literal in the expression is 255 characters. A longer string can be split into smaller strings of up to 255 characters each, and the smaller strings concatenated with the + operator. For example, you can create a 500-character string as follows: '"<string of 255 characters>" + "<string of 245 characters>"'

(Classic expressions are not supported in the cluster build.)

The following requirements apply only to the NetScaler CLI:

* If the expression includes one or more spaces, enclose the entire expression in double quotation marks.

* If the expression itself includes double quotation marks, escape the quotations by using the \\ character.

* Alternatively, you can use single quotation marks to enclose the rule, in which case you do not have to escape the double quotation marks.

action

Name of the rewrite action to perform if the request or response matches this rewrite policy.

There are also some built-in actions which can be used. These are:

* NOREWRITE - Send the request from the client to the server or response from the server to the client without making any changes in the message.

* RESET - Resets the client connection by closing it. The client program, such as a browser, will handle this and may inform the user. The client may then resend the request if desired.

* DROP - Drop the request without sending a response to the user.

undefAction

Action to perform if the result of policy evaluation is undefined (UNDEF). An UNDEF event indicates an internal error condition. Only the above built-in actions can be used.

comment

Any comments to preserve information about this rewrite policy.

logAction

Name of messagelog action to use when a request matches this policy.

Example

set rewrite policy pol9 -rule "HTTP.REQ.HEADER(\\\\"header\\\\").CONTAINS(\\\\"qh2\\\\")"

unset rewrite policy

Removes the settings of an existing rewrite policy. Attributes for which a default value is available revert to their default values. See the set rewrite policy command for a description of the parameters..Refer to the set rewrite policy command for meanings of the arguments.

Synopsys

unset rewrite policy <name> [-undefAction] [-comment] [-logAction]

Example

unset rewrite policy pol9 -undefAction

show rewrite policy

Displays the current settings for the specified rewrite policy. If no policy name is provided, displays a list of all rewrite policies currently configured on the NetScaler appliance.

Synopsys

show rewrite policy [<name>] show rewrite policy stats - alias for 'stat rewrite policy'

Arguments

name

Name of the rewrite policy.

Outputs

stateflag

rule

Expression against which traffic is evaluated. Written in default syntax.

Note:

Maximum length of a string literal in the expression is 255 characters. A longer string can be split into smaller strings of up to 255 characters each, and the smaller strings concatenated with the + operator. For example, you can create a 500-character string as follows: '"<string of 255 characters>" + "<string of 245 characters>"'

(Classic expressions are not supported in the cluster build.)

The following requirements apply only to the NetScaler CLI:

* If the expression includes one or more spaces, enclose the entire expression in double quotation marks.

* If the expression itself includes double quotation marks, escape the quotations by using the \\ character.

* Alternatively, you can use single quotation marks to enclose the rule, in which case you do not have to escape the double quotation marks.

action

Rewrite action associated with the policy.

undefAction

Undef Action associated with the policy.

hits

Number of hits.

undefHits

Number of Undef hits.

activePolicy

Indicates whether policy is bound or not.

boundTo

Location where policy is bound

priority

Specifies the priority of the policy.

gotoPriorityExpression

Expression specifying the priority of the next policy which will get evaluated if the current policy rule evaluates to TRUE.

labelType

Type of policy label invocation.

labelName

Name of the label to invoke if the current policy rule evaluates to TRUE.

description

Description of the policy

comment

Any comments to preserve information about this rewrite policy.

logAction

Name of messagelog action to use when a request matches this policy.

bindPolicyType

isDefault

A value of true is returned if it is a default rewritepolicy.

vserverType

builtin

Flag to determine if rewrite policy is built-in or not

devno

count

Example

show rewrite policy

stat rewrite policy

Displays statistics for the specified rewrite policy. If no policy name is specified, displays abbreviated statistics for all rewrite policies currently configured on the NetScaler appliance.

Synopsys

stat rewrite policy [<name>] [-detail] [-fullValues] [-ntimes <positive_integer>] [-logFile <input_filename>] [-clearstats ( basic | full )]

Arguments

name

Name of the rewrite policy.

detail

Specifies detailed output (including more statistics). The output can be quite voluminous. Without this argument, the output will show only a summary.

fullValues

Specifies that numbers and strings should be displayed in their full form. Without this option, long strings are shortened and large numbers are abbreviated

ntimes

The number of times, in intervals of seven seconds, the statistics should be displayed.

Default value: 1

Minimum value: 0

logFile

The name of the log file to be used as input.

clearstats

Clear the statsistics / counters

Possible values: basic, full

Outputs

count

devno

stateflag

Outputs

Policy hits (Hits)

Number of hits on the policy

Policy undef hits (Undefhits)

Number of undef hits on the policy

Example

stat rewrite policy

Related Commands

rename rewrite policy

Renames the specified rewrite policy. You must restart the NetScaler appliance to put new name in effect.

Synopsys

rename rewrite policy <name>@ <newName>@

Arguments

name

Existing name of the rewrite policy.

newName

New name for the rewrite policy.

Must begin with a letter, number, or the underscore character (_), and must contain only letters, numbers, and the hyphen (-), period (.) hash (#), space ( ), at (@), equals (=), colon (:), and underscore characters.

The following requirement applies only to the NetScaler CLI:

If the name includes one or more spaces, enclose the name in double or single quotation marks (for example, "my rewrite policy" or ?my rewrite policy?).

Example

rename rewrite policy oldname newname