Creating Variables in Application Templates

Application templates support the declaration of variables in the policy expressions and actions that are configured for an application. The ability to declare variables in policy expressions and actions enables you to replace preconfigured values in expressions (for example, configurable parameters such as the host name of a server or the target for a Rewrite action) with values that suit the environment into which you are importing the template. If variables have been configured for an AppExpert application template, the AppExpert Template Wizard, which appears when you import an AppExpert application template, includes a Specify Variable Values page on which you can specify appropriate values for the variables that are configured for the template.

As an example, consider the following policy expression that is configured to evaluate the value of the Host header in an HTTP request:


If you want the server name to be configurable at import time, you can specify the string “server1” as a variable. When importing the template, you can specify a new value for the variable on the Variables tab.

After you create a variable, you can do the following:

  • Assign additional strings to an existing variable. After you create a variable for a string, you can select and assign other parts of the same or different expression to the variable. The strings you assign to a variable need not be the same. At import time, all the strings that are assigned to the variable are replaced with the value that you provide.
  • View the string or strings that are assigned to the variable.
  • View a list of all the entities and parameters that use the variable.

In the export application template wizard, you can define variables in certain fields (fields with an adjacent button button) for the following entities:

  • Cache policies
  • Rewrite policies
  • Rewrite actions
  • Responder policies
  • Responder actions

To configure a variable in a policy expression or action by using the GUI:

  1. Navigate to AppExpert > Variables.
  2. In the Variables page, click Add.
  3. In the Create Variables page, set the following parameters. Name. Name of the variable.

    Scope. Select the scope as Global or transaction.

    Type. Select the variable type as text, ulong, map.

    Expires in. Enter the expiry date.

    If Full*. Action to perform if an assignment to a map exceeds its configured max-entries: lru - (default) reuse the least recently used entry in the map. undef - force the assignment to return an undefined (Undef) result to the policy executing the assignment. Possible values: undef, lru Default value: lru.

    if no value. Value expiration in seconds. If the value is not referenced within the expiration period it will be deleted. 0 (the default) means no expiration. Minimum value: 0, Maximum value: 31622400

    Init Value. Initialization value for this variable, to which a singleton variable or map entry will be set if it is referenced before an assignment action has assigned it a value. If the singleton variable or map entry already has been assigned a value, setting this parameter will have no effect on that variable value. Default: 0 for ulong, NULL for text Maximum Length: 127

    Comments. A brief description about the variable.

  4. Click Close.
Creating Variables in Application Templates