Skip to main content
Variable expansion allows Edge Rules to dynamically configure values based on specific request parameters. Instead of hardcoding URLs or header values, you can use variables that are replaced at runtime with actual request data.

Supported actions

Variable expansion works with the following Edge Rule actions:
  • Change Origin URL
  • Redirect to URL
  • Set Request Header
  • Set Response Header

Syntax

Variables are accessed using the following syntax:
Where Collection is a group of related variables, and Key is the specific value you want to access.
For a complete list of all available variables with examples, see Dynamic Variables.

Variable collections

RequestHeaders

The RequestHeaders collection contains HTTP headers from the incoming request. Headers are automatically mapped based on their name.

Query

The Query collection contains URL query parameters. Parameters are automatically mapped based on their key. For a URL like ?token=abc123&user=42:

Request

The Request collection contains information about the HTTP request:

Path

The Path collection allows you to extract specific segments from the URL path using index-based access. For the path /hello/world/bunny/eat/carrot.jpg:

Url

The Url collection provides parsed components of the request URL:

User

The User collection contains information about the requesting user:

Server

The Server collection contains information about the serving edge server:

Examples

Dynamic origin routing

Route requests to different origins based on the first path segment: Origin URL: https://%{Path.0}.backend.example.com/%{Path.1-} For a request to /api/users/123, this becomes https://api.backend.example.com/users/123.

Pass query parameter as header

Forward a specific query parameter to your origin as a header: Header Name: X-Auth-Token
Header Value: %{Query.token}

Geo-based routing

Add the user’s country to the origin request: Header Name: X-Country
Header Value: %{User.CountryCode}

Last modified on January 6, 2026