Instruction manual

Appendix A: Policy Expressions
A-12 NetScaler 9000 Series Installation and Configuration Guide - Volume 1
NSICG60_JAN05
Example
add expression txt_url "url == *.txt"
add expression can_compress "header user-agent contains
‘Internet Explorer’ && (txt_url || res.http.header
content-encoding == text/html)"
A.1.2.4 White space and escape sequences in operand string
While specifying the rules in policies (or expressions in add policy
expression), if white space characters (space or tab) or escape sequences
add cs policy cs_pol1 -rule "url CONTAINS sports ||
http_port || (HEADER Cookie contains ’abc pqr
or
add cs policy cs_pol1 -rule "url CONTAINS sports ||
http_port || (HEADER Cookie contains \"abc pqr
or
add cs policy cs_pol1 -rule "url CONTAINS sports ||
http_port || (HEADER Cookie contains \’abc pqr
To specify double quotes/single quotes within rule string (or expression),
triple escaped quotes (\\” or \\’) should be used. Below are examples:
add cs policy cs_pol2 -rule "url contains ’a \\"b\\"
\\’c\\’ d’"
or
add cs policy cs_pol2 -rule "url contains \"a \\"b\\"
\\'c\\\' d\""
or
add cs policy cs_pol2 -rule "url contains \’a \\"b\\"
\\’c\\’ d\’"
A.1.3 Length and Offset Expressions
Length and Offset parameters are used in expressions that are configured for
either making the load balancing decisions, or with persistence. For example,
the load balancing algorithm is set to token, or the persistence is set to any of
rule, urlPassive or customerServerID.