ADC CLI Commands

cmp-policy

The following operations can be performed on “cmp-policy”:

add set show rename rm stat

add cmp policy

Creates a HTTP compression policy. When the policy matches an HTTP request or response, the action specified in the policy is performed on the transaction. The policy can be bound globally or to an entity. For the policy to have an effect, compression must be enabled on the service.

Synopsis

add cmp policy -rule -resAction

Arguments

name Name of the HTTP compression policy. Must begin with an ASCII alphabetic or underscore (_) character, and must contain only ASCII alphanumeric, underscore, hash (#), period (.), space, colon (:), at (@), equals (=), and hyphen (-) characters. Can be changed after the policy is created.

The following requirement applies only to the Citrix ADC CLI: If the name includes one or more spaces, enclose the name in double or single quotation marks (for example, “my cmp policy” or ‘my cmp policy’).

rule Expression that determines which HTTP requests or responses match the compression policy.

The following requirements apply only to the Citrix ADC 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.

resAction The built-in or user-defined compression action to apply to the response when the policy matches a request or response.

Example

Example 1:

add cmp policy pdf_cmp -rule “HTTP.RES.HEADER("Content-Type").CONTAINS("application/pdf")” -resAction COMPRESS

After creating the above compression policy, you must activate it by binding it globally: bind cmp global pdf_cmp -priority 100

The Citrix ADC system will use the configured pdf_cmp compression policy to perform compression of pdf files.

Example 2:

The following command disables compression for all the access from the specific subnet. add cmp policy local_sub_nocmp -rule “CLIENT.IP.SRC.IN_SUBNET(10.1.1.0/24)” -resAction NOCOMPRESS bind cmp global local_sub_nocmp -priority 200

set cmp policy

Modifies the specified parameters of an HTTP compression policy. Note: Use the show cmp policy command to view all configured HTTP compression policies.

Synopsis

set cmp policy [-rule ] [-resAction ]

Arguments

name Name of the HTTP compression policy to be modified.

rule New rule to be associated with the HTTP compression policy. You can modify the existing rule or create a new rule.

resAction The built-in or user-defined compression action to be associated with the policy.

Example

Example 1:

add cmp policy pdf_cmp -rule “HTTP.RES.HEADER("Content-Type").CONTAINS("application/pdf")” -resAction COMPRESS

After creating the above compression policy, you must activate it by binding it globally: bind cmp global pdf_cmp -priority 100

The Citrix ADC system will use the configured pdf_cmp compression policy to perform compression for pdf files.

To disable pdf compression for Internet Explorer, you can change the above compression policy by issuing the following command:

set cmp policy pdf_cmp -rule “HTTP.RES.HEADER("Content-Type").CONTAINS("application/pdf") && HTTP.RES.HEADER("User-Agent").CONTAINS("MSIE").NOT”

To view the changed cmp policy, enter the following command:

show cmp policy pdf_cmp Name: pdf_cmp Rule: (“HTTP.RES.HEADER("Content-Type").CONTAINS("application/pdf") && HTTP.RES.HEADER("User-Agent").CONTAINS("MSIE").NOT) Response action: COMPRESS Hits: 2 Bytes In:…609284 Bytes Out:… 443998 Bandwidth saving…27.13% Ratio 1.37:1 Done

show cmp policy

Displays details of all HTTP compression policies.

Synopsis

show cmp policy [] show cmp policy stats - alias for 'stat cmp policy'

Arguments

name Name of the HTTP compression policy for which to display details.

Output

stateflag rule The request/response rule that will trigger the specified compression action.

reqAction The compression action to be performed on requests.

resAction The compression action to be performed on responses.

hits Number of hits.

txbytes Number of bytes transferred.

rxbytes Number of bytes received.

clientTTLB Total client TTLB value.

clientTransactions Number of client transactions.

serverTTLB Total server TTLB value.

serverTransactions Number of server transactions.

boundTo The name of the entity to which the policy is bound.

activePolicy priority 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

vserverType builtin Flag to determine if compression policy is builtin or not

feature The feature to be checked while applying this config

type isDefault A value of true is returned if it is a default policy

devno count

Example

show cmp policy 4 Compression policies: 1) Name: ns_adv_cmp_content_type Rule: HTTP.RES.HEADER(“Content-Type”).CONTAINS(“text”) Response action: COMPRESS Hits: 1 Bytes In:…4325 Bytes Out:… 1530 Bandwidth saving…64.62% Ratio 2.83:1 2) Name: ns_adv_cmp_mscss Rule: (ns_msie_adv && HTTP.RES.HEADER(“Content-Type”).CONTAINS(“text/css”)) Response action: COMPRESS Hits: 0 3) Name: ns_adv_nocmp_mozilla_47 Rule: (HTTP.REQ.HEADER(“User-Agent”).CONTAINS(“Mozilla/4.7”) && HTTP.RES.HEADER(“Content-Type”).CONTAINS(“text/css”)) Response action: NOCOMPRESS Hits: 0 Done

You can also view an individual cmp policy by giving the cmp policy name as an argument:

show cmp policy ns_adv_cmp_content_type Name: ns_adv_cmp_content_type Rule: HTTP.RES.HEADER(“Content-Type”).CONTAINS(“text”) Response action: COMPRESS Hits: 7 Bytes In:…796160 Bytes Out:… 197730 Bandwidth saving…75.16% Ratio 4.03:1 Done

rename cmp policy

Renames a compression policy.

Synopsis

rename cmp policy @ @

Arguments

name Existing name of the policy.

newName New name for the compression policy. Must begin with an ASCII alphabetic or underscore (_) character, and must contain only ASCII alphanumeric, underscore, hash (#), period (.), space, colon (:), at (@), equals (=), and hyphen (-) characters. Choose a name that reflects the function that the policy performs.

The following requirement applies only to the Citrix ADC CLI: If the name includes one or more spaces, enclose the name in double or single quotation marks (for example, “my cmp policy” or ‘my cmp policy’).

Example

rename cmp policy oldname newname

rm cmp policy

Removes a user-defined HTTP compression policy.

Synopsis

rm cmp policy

Arguments

name Name of the HTTP compression policy to be removed.

Example

rm cmp policy cmp_policy_name The “show cmp policy” command shows all currently defined HTTP compression policies.

stat cmp policy

Displays compression statistics for all compression policies, or for only the specified policy.

Synopsis

stat cmp policy [] \[-detail] \[-fullValues] \[-ntimes <positive\_integer>] \[-logFile <input\_filename>] \[-clearstats \( basic | full )]

Arguments

name Name of the compression policy for which to display statistics. If no name is specified, statistics for all compression polices are shown.

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

Output

count devno stateflag

Counters

Policy hits (Hits) Number of hits on the policy

Policy undef hits (Undefhits) Number of undef hits on the policy

Example

stat cmp policy

cmp-policy