Instruction manual
Appendix A: Policy Expressions
A-2 NetScaler 9000 Series Installation and Configuration Guide - Volume 1
NSICG60_JAN05
Example
add expression ext_asp "URL == /*.asp"
add cmp policy cmp_asp -rule ext_asp -resAction COMPRESS
add cs policy cs_asp -rule ext_asp
Notice that the commands to create the compression and content switching
policies invoked identical expressions but different actions.
A.1 Understanding Expressions
Expressions are the most fundamental components of a policy. It represents a
single condition that is evaluated against an HTTP request (or in some cases,
such as caching and compression, against the HTTP response). You can
create a simple expression to check for conditions such as:
z File types
z Length of a URL
z Contents of the host header
z Browser type
The following examples illustrate the creation of expressions using the add
expression command.
add expression gif_file "URL == /*.gif"
add expression url_len "URLLEN > 5"
add expression has_cookie "HEADER Cookie EXISTS"
add expression browser_mozilla "HEADER User-Agent
CONTAINS Mozilla"
You can also combine expressions to create compound expressions.
add expression image_file "gif_file || URL == *.jpeg ||
URL == *.jpg"
A.1.1 Components of an Expressions
Expressions consist of the following components:
z Qualifier: The qualifier represents the information within a request that
needs to be tested. The HTTP method, URL, and length of a URL are
examples of qualifiers.