Create named classic expressions
A named classic expression is a classic expression that can be referenced through an assigned name. Often, you need to configure classic expressions that are large or complex and form a part of a larger compound expression. You might also configure classic expressions that you need to use frequently and in multiple compound expressions or classic policies. In these scenarios, you can create the classic expression you want, save it with a name of your choice, and then reference the expression from compound expressions or policies through its name. This saves configuration time and improves the readability of complex compound expressions. Additionally, any modifications to a named classic expression need to be made only once.
Some named expressions are built-in, and a subset of these are read-only. Built-in named expressions are divided into four categories: General, Anti-Virus, Personal Firewall, and Internet Security. General named expressions have a wide variety of uses. For example, from the General category, you can use the expressions ns_true and ns_false to specify a value of TRUE or FALSE, respectively, to be returned for all traffic. You can also identify data of a particular type (for example, HTM, DOC, or GIF files), determine whether caching headers are present, or determine whether the round trip time for packets between a client and the Citrix ADC is high (over 80 milliseconds).
Anti-Virus, Personal Firewall, and Internet Security named expressions test clients for the presence of a particular program and version and are used primarily in Citrix Gateway policies.
Note:You cannot modify or delete built-in named expressions.
Create a named classic expression by using the CLI
At the command prompt, type the following commands to set the parameters and verify the configuration:
- add expression [-comment ] [-clientSecurityMessage ] - show expression [ | -type CLASSIC
Example
> add expression classic_ne "REQ.HTTP.URL CONTAINS www.example1.com" -comment "Checking the URL for www.example1.com" Done > show expression classic_ne 1) Name: classic_ne Expr: REQ.HTTP.URL CONTAINS www.example1.com Hits: 0 Type : CLASSIC Comment: "Checking the URL for www.example1.com" Done >
Create a named classic expression by using the GUI
In the navigation pane, expand AppExpert, expand Expressions, and then click Classic Expressions.
In the details pane, click Add.
Note: Some of the built-in expressions in the Expressions list are read-only.
In the Create Policy Expression dialog box, specify values for the following parameters:
- Expression Name*—name
- Client Security Message—clientSecurityMessage
- Comments—comment
*A required parameter
To create the expression, do one of the following:
- You can choose inputs to this expression from the Named Expressions drop-down list.
- You can create a new expression, as described inAdd an expression for a classic policy by using the GUI.
When you are done, click Close. Verify that your new expression was created by scrolling to the bottom of the Classic Expressions list to view it.