Variables overview
Variables give you more control over your configuration. They provide more flexibility when using existing advanced metadata through the use of input/output variables. Create complex properties without the need to implement advanced metadata.
Variables allow you to:
-
Make a complex forward path modification
-
Select origin based on a pattern
-
Read, add, and modify HTTP headers and cookies
-
Input to advanced metadata
-
Output from advanced metadata to drive further behaviors
Prerequisites
Variable support is available for certain products. If you don't see variable support listed as an available module for a product, contact your account representative to learn more.
You can use built-in variables right away, but to add a user-defined variable to a behavior, first you need to create one.
Notes and restrictions
-
A value has a maximum size limit of 8k per variable. Using advanced metadata, the size limit is 16k. Contact your account support representative for help configuring advanced metadata.
-
Variable support includes request-stage built-in variables only. For information or assistance with variables form any other stage, contact your account support representative.
-
Variable support does not currently distinguish our parent edge servers from our child edge servers. If you need to distinguish between these types of servers, for instance to implement a different functionality, contact your support representative.
Variable types
There are two types of variables. Built-in variables that are read-only variables that address common information about each request, and user-defined variables that you can create, edit, or otherwise modify.
Behaviors that support variables
Many Property Manager behaviors have fields that support the use of variables – they show the "(variable support)" note under the text field. The following behaviors accept variables:
-
Construct Response
-
Modify Incoming Request Header
-
Modify Incoming Response Header
-
Modify Outgoing Request Header
-
Modify Outgoing Response Header
-
Modify Outgoing Request Path
-
Origin Base Path
-
Origin Server
-
Redirect
-
Redirect Plus
-
Set Response Cookie
-
Set Variable
-
Site Failover
Syntax
Use the following syntax in any of the behaviors that allow variable support.
{{variableType.variableName}}
Where variable type is either "built-in" or "user".
The built-in variables correspond to underlying metadata variables, typically prefixed with AK_
. For instance,{{builtin.AK_PATH}}
corresponds to the %(AK_PATH)
metadata variable.
The global user variables are prefixed with PMUSER_
in the underlying metadata, for instance, {{user.PMUSER_FOO}}
corresponds to %(PMUSER_FOO)
in metadata syntax.
The local user variables you create on an include level are prefixed with PMINC_<includeId>
in the underlying metadata, for instance {{user.PMINC_inc_12345}}
corresponds to %(user.PMINC_inc_12345)
in metadata syntax.
Here is an example variable expression syntax that includes a builtin variable, a fixed string, and a user defined variable:
{{builtin.AK_PATH}}fixedstring{{user.PMUSER_FOO}}
Updated almost 2 years ago