Product Documentation

cs policy

Sep 12, 2016

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

add | rm | set | unset | show | rename

add cs policy

Creates a new content switching policy. You use this policy to manage content switching on a virtual server.

Synopsys

add cs policy <policyName> [-url <string> | -rule <expression> | -action <string>] [-domain <string>] [-logAction <string>]

Arguments

policyName

Name for the content switching policy. Must begin with an ASCII alphanumeric or underscore (_) character, and must contain only ASCII alphanumeric, underscore, hash (#), period (.), space, colon (:), at sign (@), equal sign (=), and hyphen (-) characters. Cannot be changed after a policy is created.

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 policy or my policy).

url

URL string that is matched with the URL of a request. Can contain a wildcard character. Specify the string value in the following format: [[prefix] [*]] [.suffix].

rule

Expression, or name of a named expression, against which traffic is evaluated. Written in the classic or 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>"'

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.

domain

The domain name. The string value can range to 63 characters.

action

Content switching action that names the target load balancing virtual server to which the traffic is switched.

logAction

The log action associated with the content switching policy

Example

To match the requests that have URL "/", you would enter the following command: add cs policy <policyName> -url / To match with all URLs that start with "/sports/", you would enter the following command: add cs policy <policyName> -url /sports/* To match requests with URLs that start with "/sports", you would enter the following command: add cs policy <policyName> -url /sports* To match requests with the URL "/sports/tennis/index.html", you would enter the following command: add cs policy <policyName> -url /sports/tennis/index.html To match requests that have URLs with the extension "jsp", you would enter the following command: add cs policy <policyName> -url /*.jsp To match requests with URLs that start with "/sports/" and the file extension "jsp", you would enter the following command: add cs policy <policyName> -url /sports/*.jsp To match requests with URLs that contain "sports", you would enter the following commands: add pol expression sports_url "URL contains sports" add cs policy <policyName> -rule sports_url To match requests with URL queries that contain "gold" or cookie headers that contain "gold", you would enter the following commands: add pol expression gold_query "URLQUERY contains gold" add pol expression gold_cookie "Header COOKIE contains gold" add cs policy <policyName> -rule "(gold_query ||gold_cookie)" To match requests with the domain name www.domainxyz.com, you enter the following command: add cs policy <policyName> -domain "www.domainxyz.com" To match requests with the domain name www.domainxyz.com and URLs with the extension "jsp", you would enter the following command: add cs policy <policyName> -url /*.jsp -domain "www.domainxyz.com" To match requests with the domain name www.domainxyz.com and URLs that contain "sports", you would enter the following commands: add pol expression sports_url "URL contains sports" add cs policy <policyName> -rule sports_url -domain "www.domainxyz.com" To match a policy with a rule and provide action: add cs policy <policyname> -rule "http.req.method.eq(GET)" -action act1

rm cs policy

Removes a content switching policy. You can delete a user-defined content switching policy that is not bound to a content switching virtual server. If the policy is bound to a virtual server, you must first unbind the policy, and then remove it.

Synopsys

rm cs policy <policyName>

Arguments

policyName

Name of the content switching policy to be removed.

set cs policy

Changes an existing content switching policy.

Synopsys

set cs policy <policyName> [-url <string> | -rule <expression>] [-domain <string>] [-action <string>] [-logAction <string>]

Arguments

policyName

Name of the content switching policy.

url

The URL, with wildcards.

rule

The condition for applying this policy.

domain

The domain name.

action

The content switching action name.

logAction

The log action associated with the content switching policy

unset cs policy

Unset logaction for existing content swtching policy..Refer to the set cs policy command for meanings of the arguments.

Synopsys

unset cs policy <policyName> [-logAction] [-url] [-rule] [-domain] [-action]

Example

unset cs policy pol9 -logAction

show cs policy

Displays all existing content switching policies, or just the specified policy.

Synopsys

show cs policy [<policyName>]

Arguments

policyName

Name of the content switching policy to display. If this parameter is omitted, details of all the policies are displayed.

Outputs

url

The URL with wildcards.

rule

The condition for applying this policy.

domain

The domain name.

action

The CS action name.

vstype

Virtual server type.

hits

Total number of hits.

piHits

Total number of hits.

bindHits

Total number of hits.

piPolicyhits

bind hits for PI CS Policy.

labelName

Name of the label invoked.

labelType

The invocation type.

target

Target flag

priority

priority of bound policy

flag

stateflag

activePolicy

Indicates whether policy is bound or not.

csPolicyType

Indicates whether policy is PI or not.(used only during display)

logAction

The log action associated with the content switching policy

gslbBindings

devno

count

Related Commands

rename cs policy

Rename a content switching policy.

Synopsys

rename cs policy <policyName>@ <newName>@

Arguments

policyName

The name of the content switching policy.

newName

The new name of the content switching policy.

Example

rename cs policy oldname newname