Global User Variables

Sometimes, we need to dynamically decide whether to enable certain page rules of different applications based on some information. In this case, you can use Global User Variables to solve the problem.

Global User Variables provide various types of variables: strings, booleans, numbers, constants and so on. You can choose the appropriate type to create a variable.

Define a Variable

Go to Global Config > Global User Variables

Click the Add Variable button to add a new variable:

Enter the information for the variable: name, type, default value, etc. After adding it, you will get a record like the following:

When modifying or using variables later, specify the variable through $or-global-ID.

Modify a Variable

You can modify a variable at runtime with Edgelang:

For example, set it to request uri.

Use a Variable

Variables can be used in page rule conditions to dynamically enable the page rules:

They can also be used in access logs: