Edgio

Feature Variables Reference

Feature variables retrieves request and response metadata. Use this metadata to dynamically alter a request or a response.
The following features support variables:

Definitions

Feature variables are categorized as follows:

Client Device

This category contains feature variables that describe the client’s device or browser.
TypeVariableDescription
Brand Name%{wurfl_cap_brand_name}Indicates the brand name of the device.
Sample Value: Samsung
Device OS%{wurfl_cap_device_os}Indicates the operating system installed on the device.
Sample Value: IOS
Device OS Version%{wurfl_cap_device_os_version}Indicates the version number of the OS installed on the device.
Sample Value: 1.0.1
Dual Orientation%{wurfl_cap_dual_orientation}Indicates whether the device supports dual orientation.
Sample Value: true
HTML Preferred DTD%{wurfl_cap_html_preferred_dtd}Indicates the mobile device’s preferred document type definition (DTD) for HTML content.
Sample Value: html5
Image Inlining%{wurfl_cap_image_inlining}Indicates whether the device supports Base64-encoded images.
Sample Value: false
Is Android%{wurfl_vcap_is_android}Indicates whether the device uses the Android OS.
Sample Value: true
Is App%{wurfl_vcap_is_app}Indicates whether a native application requested content.
Sample Value: true
Is Full Desktop%{wurfl_vcap_is_full_desktop}Indicates whether the device provides a full desktop experience.
Sample Value: true
Is IOS%{wurfl_vcap_is_ios}Indicates whether the device uses iOS.
Sample Value: false
Is Robot%{wurfl_vcap_is_robot}Indicates whether the device is considered to be an automated HTTP client (e.g., a robot crawler).
Sample Value: true
Is Smart TV%{wurfl_cap_is_smarttv}Indicates whether the device is a smart TV.
Sample Value: false
Is Smartphone%{wurfl_vcap_is_smartphone}Indicates whether the device is a smartphone.
Sample Value: true
Is Tablet%{wurfl_cap_is_tablet}Indicates whether the device is a tablet. This is an OS-independent description.
Sample Value: true
Is Touchscreen%{wurfl_vcap_is_touchscreen}Indicates whether the device’s primary pointing device is a touchscreen.
Sample Value: true
Is Windows Phone%{wurfl_vcap_is_windows_phone}Indicates whether the device is a a Windows Mobile 6.5/Windows Phone 7 or later.
Sample Value: true
Is Wireless Device%{wurfl_cap_is_wireless_device}Indicates whether the device is considered a wireless device For the purposes of this capability, PCs and laptops are not considered to be mobile devices.
Sample Value: true
Marketing Name%{wurfl_cap_marketing_name}Indicates the device’s marketing name.
Sample Value: BlackBerry 8100 Pearl
Mobile Browser%{wurfl_cap_mobile_browser}Indicates the browser used to request content from the device.
Sample Value: Chrome
Mobile Browser Version%{wurfl_cap_mobile_browser_version}Indicates the version of the browser used to request content from the device.
Sample Value: 31
Model Name%{wurfl_cap_model_name}Indicates the device’s model name.
Sample Value: s10
Progressive Download%{wurfl_cap_progressive_download}Indicates whether the device supports the playback of audio/video while it is still being downloaded.
Sample Value: true
Release Date%{wurfl_cap_release_date}Indicates the year and month on which the device was added to the WURFL database.
Format: yyyy_mm
Sample Value: 2022_december
Resolution Height%{wurfl_cap_resolution_height}Indicates the device’s height in pixels.
Sample Value: 768
Resolution Width%{wurfl_cap_resolution_width}Indicates the device’s width in pixels.
Sample Value: 1024

Client Geography

This category contains feature variables that describe the client’s geography.
A blank value is returned when GEO metadata is unavailable for a particular request.
TypeVariableDescription
City (Client)%{geo_city}Indicates the client’s city.
Sample Value: Los Angeles
Continent (Client)%{geo_continent}Indicates the client’s continent through its abbreviation. Valid values are:
  • AF: Africa
  • AS: Asia
  • EU: Europe
  • NA: North America
  • OC: Oceania
  • SA: South America

Sample Value: NA
Country (Client)%{geo_country}Indicates the country from which the requested originated through its country code.
Sample Value: US
Designated Market Area (Client)%{geo_dma_code}Indicates the client’s media market by its region code. This field is only applicable to requests that originate from the United States.
Sample Value: 745
Latitude (Client)%{geo_latitude}Indicates the client’s latitude.
Sample Value: 34.0995
Longitude (Client)%{geo_longitude}Indicates the client’s longitude.
Sample Value: -118.4143
Metropolitan Statistical Area (Client)%{geo_metro_code}Indicates the client’s metropolitan area. This field is only applicable to requests that originate from the United States.
Sample Value: 745
Postal Code (Client)%{geo_postal_code}Indicates the client’s postal code. We only return the first 3 characters for Canadian postal codes and the first 2 - 4 characters for United Kingdom postal codes.
Sample Value: 90210
Region (Client)%{geo_region}Indicates the client’s region (e.g., state or province) through its alphanumeric abbreviation.
Sample Value: CA

Client Network

This category contains feature variables that describe the client’s network.
TypeVariableDescription
ASN (Client)%{geo_asnum}Indicates the client’s AS number.
Sample Value: AS15133
IP Address (Client)%{virt_dst_addr}Indicates the client’s IP address.
Sample Value: 192.168.1.1
Port (Client)%{virt_dst_port}Indicates the client’s ephemeral port.
Sample Value: 55885

General

This category contains the QUIC Versions feature variable.
TypeVariableDescription
QUIC Versions%{quic_altsvc_versions}Indicates the set of QUIC versions supported by our CDN service. This variable identifies QUIC versions using Google’s latest specification.
Sample Value: h3-Q049=":443"; ma=2592000,h3-Q048=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000

mTLS

This category contains feature variables that describe a client’s mTLS authentication request.
TypeVariableDescription
Client Certificate%{virt_ssl_client_cert}Contains the client certificate in PEM format.
Example: -----BEGIN%20CERTIFICATE----- ... %0A-----END%20CERTIFICATE-----%0A
Client Certificate’s Days to Expiration%{virt_ssl_client_v_remain}Indicates the number of days until the client certificate will expire.
Example: 123
Client Certificate’s Expiration Date%{virt_ssl_client_v_end}Indicates the date and time (GMT) at which the client certificate will expire.
Example: Aug 7 18:54:27 2033 GMT
Client Certificate’s Fingerprint%{virt_ssl_client_fingerprint}Contains the client certificate’s SHA1 fingerprint.
Example: 7C2E166156E2D165AD7468B0E0145411B655F041
Client Certificate’s Issued Date%{virt_ssl_client_v_start}Indicates the date and time (GMT) at which the client certificate was issued.
Example: Aug 10 18:54:27 2023 GMT
Client Certificate’s Serial Number%{virt_ssl_client_serial}Indicates the client certificate’s serial number.
Example: 655603895D3E8ECC4DF507FB33A1171A53F37CAF
Client Certificate’s Validation Status%{virt_ssl_client_verify}Indicates the result for the validation of the client certificate. Valid values are:
  • SUCCESS: Certificate validation is required and the client provided a valid certificate.
  • LENIENT: Certificate validation is not required, but the client provided a valid certificate.
  • FAILED <REASON>: The client did not provide a valid certificate. Check the reason to find out more information.
  • NONE: Certificate validation is not required and the client did not provide one.
Distinguished Name - Issuer%{virt_ssl_client_i_dn}Identifies the Distinguished Name (DN) for the client certificate’s issuer.
Example: CN=ACME INTERMEDIATE CLIENT CA,OU=Security,O=ACME Inc.,L=Los Angeles,ST=California,C=US
Distinguished Name - Subject%{virt_ssl_client_s_dn}Identifies the Distinguished Name (DN) for the client certificate’s subject.
Example: CN=www.example.com,OU=Security,O=ACME Inc.,L=Los Angeles,ST=California,C=US

Request

This category contains feature variables that describe the request.
TypeVariableDescription
Cookie Value%{cookie_<COOKIE>}Returns the value corresponding to the cookie identified by the <COOKIE> term. Replace dashes in the cookie name with underscores (e.g., change preferences-cookie to preferences_cookie).
Sample Usage: %{cookie__utma}
Sample Value: 111662281.2.10.1222100123
HTTP Method%{request_method}Indicates the HTTP request method.
Sample Value: GET
JA3 MD5 Hash%{virt_ssl_client_ja3_md5}Indicates the JA3 fingerprint assigned to the request. A JA3 fingerprint identifies a client using key characteristics from a TLS request. This allows us to classify traffic across various IP addresses and ports.
Normalized Path%{normalized_path}Indicates the normalized relative path for the request submitted to the CDN.
Key information:
  • This relative path excludes the query string.
  • This relative path corresponds to the request submitted to the CDN and it does not reflect URL rewrites.
  • URL normalization, as defined in RFC 3986, was applied to this value.
Sample Value: /marketing/images/bunny.png
Normalized Query String%{normalized_query}Indicates the normalized query string defined in the request URL. URL normalization, as defined in RFC 3986, was applied to this value.
Original Query String: "client=/123?"
Sample Value: %22client=/123?%22
Normalized URI%{normalized_uri}Indicates the normalized relative path and query string for the request submitted to the CDN.
Key information:
  • This relative path corresponds to the request submitted to the CDN and it does not reflect URL rewrites.
  • URL normalization, as defined in RFC 3986, was applied to this value.
Sample Value: /dir/foo.js?%22client=/123?%22
Path%{path}Indicates the relative path to the requested content.
Key information:
  • This relative path excludes the query string.
  • This relative path reflects URL rewrites due to url_rewrite.

Sample Value: /rewrittendir/foo.js
Query String Found%{is_args}The value for this variable varies according to whether the request contains a query string.
  • Query String Found: ?
  • No Query String: NULL
Sample Value: ?
Query String Parameter Found%{is_amp}The value for this variable varies according to whether the request contains at least one query string parameter.
  • Parameter Found: &
  • No Parameters: NULL
Sample Value: &
Query String Parameter Value%{arg_<QUERY STRING PARAMETER>}Returns the value corresponding to the query string parameter identified by the <QUERY STRING PARAMETER> term.
Sample Usage: %{arg_language}
Sample Query String Parameter: language=en
Sample Value: en
Query String Value%{query_string}Indicates the entire query string value defined in the request URL.
Sample Value: key1=val1&key2=val2&key3=val3
Referrer Domain%{referring_domain}Indicates the domain defined in the Referer request header.
Sample Value: www.google.com
Request Header Value%{http_<REQUEST HEADER>}Returns the value corresponding to the request header identified by the <REQUEST HEADER> term. Replace dashes in the request header name with underscores (e.g., change User-Agent to User_Agent).
Sample Usage: %{http_Connection}
Sample Value: Keep-Alive
Request Host%{host}Indicates the host defined in the request URL.
Sample Value: www.example.com
Request ID%{http_x_ec_uuid}Indicates a request’s unique system-defined ID. A new ID is generated whenever a client (i.e., user agent) submits a request.
Sample Value: 12345678901234567890123456789012345678
Request Protocol (Client)%{virt_http_version}Indicates the version of the client’s request protocol.
Sample Value: 2.0
Request Protocol (Edge Server)%{request_protocol}Indicates the request protocol used by an edge server to proxy the request.
Sample Value: HTTP/1.1
Request Scheme%{scheme}Indicates the request scheme.
Sample Value: http
Request URI%{request}Describes the request.
Syntax: <HTTP METHOD> <RELATIVE PATH> <PROTOCOL>
  • <HTTP METHOD>: Indicates the HTTP method that was requested.
  • RELATIVE PATH>: Indicates the relative path, including query string parameters, defined in the request URI.
  • <PROTOCOL>: Indicates the HTTP protocol and version that was requested.
Sample Value: GET /marketing/foo.js?loggedin=true HTTP/1.1
Request URI (Relative)%{request_uri}Indicates the relative path, including the query string, defined in the request URI.
Sample Value: /marketing/foo.js?loggedin=true
Session ID%{http_x_ec_session_id}Indicates a unique system-defined ID for the request’s connection to our servers.
Multiple rapid requests by a single client may result in a single session ID when the connection is reused for those requests. Use %{http_x_ec_uuid} if you require a unique ID for each request.

Sample Value: 12345678901234567890123456789012345678
TLS Cipher Suite%{virt_ssl_cipher}Indicates the name of the cipher suite used to secure a HTTPS connection.
Sample Value: ECDHE-RSA-AES256-SHA
TLS Protocol%{virt_ssl_protocol}Indicates the SSL/TLS protocol used to secure a HTTPS connection. 
Sample Value: TLSv1.2

Response

This category contains feature variables that describe the response sent to the client.
TypeVariableDescription
HTTP Status Code%{status}Indicates the HTTP status code for the response.
Sample Value: 200
Response Header Value%{resp_<RESPONSE HEADER>}Returns the value corresponding to the response header identified by the <RESPONSE HEADER> term. Replace dashes in the response header name with underscores (e.g., change User-Agent to User_Agent).
Requests cannot be defined using variables associated with response metadata. For example, this variable cannot be used to define a request header through the set_request_headers feature.
Sample Usage: %{resp_Content_Length}
Sample Value: 100

Usage

Feature variables support the following syntax:
  • Feature Variable: Use this syntax to get the entire value corresponding to the specified feature variable.
    Example: %{host}
  • Feature Variable with a Delimiter: Use this syntax to transform the value corresponding to the specified feature variable.
    Example: The following example converts the value associated with the %{host} variable to lower-case.
    %{host,}
  • Feature Variable with a Delimiter and an Expression: Use regular expressions to replace, delete, or manipulate a feature variable’s value.
    Example: %{host/=^www\.([^\.]+)\.([^\.:]+)/cdn.$2.$3:80}
Feature variable names only support alphabet characters and underscores. Convert unsupported characters to underscores.

Delimiter Quick Reference

A delimiter can be specified after a feature variable to achieve any of the following effects:
  • Transform the value associated with the variable.
    Example: Convert the entire value to lower-case.
  • Delete the value associated with the variable.
  • Manipulate the value associated with the variable.
    Example: Use regular expressions to change the value associated with the feature variable.
A brief description for each delimiter is provided below.
DelimiterDescription
:=Indicates that a default value will be assigned to the variable when it is either missing or set to NULL.
:+Indicates that a default value will be assigned to the variable when a value has been assigned to it.
:Indicates that a substring of the value assigned to the variable will be expanded.
#Indicates that the pattern specified after this delimiter should be deleted when it is found at the beginning of the value associated with the variable.
%Indicates that the pattern specified after this delimiter should be deleted when it is found at the end of the value associated with the variable. The above definition is only applicable when the % symbol is used as a delimiter.
/Delimits a feature variable or a pattern.
//Find and replace all instances of the specified pattern.
/=Find, copy, and rewrite all occurrences of the specified pattern.
,Convert the value associated with the feature variable to lower-case.
^Convert the value associated with the feature variable to upper-case.
,,Convert all instances of the specified character in the value associated with the feature variable to lower-case.
^^Convert all instances of the specified character in the value associated with the feature variable to upper-case.

Exceptions

Text will not be treated as a feature variable under the following circumstances:
  • Escaping % Symbol: The percentage symbol can be escaped through the use of a backslash.
    Example: The following sample value will be treated as a literal value and not as a feature variable: \%{host}
  • Unknown Variables: An empty string is always returned for unknown variables.
    Example: %{unknownvariable}
  • Invalid Characters or Syntax: Variables that contain invalid characters or syntax are treated as literal values.
    Example #1: The following value contains an invalid character (i.e., -): %{resp_user-agent} Example #2: The following value contains a double set of curly braces: %&lcub;&lcub;host&rcub;&rcub; Example #3: The following value is missing a closing curly brace: %{host
  • Missing Variable Name: A NULL value is always returned when a variable is not specified.
    Example: %{}
  • Trailing Characters: Characters that trail a variable are treated as literal values.
    Example: The following sample value contains a trailing curly brace that will be treated as a literal value: %{host}}

Setting Default Header Values

A default value can be assigned to a header when it meets any of the following conditions:
  • Missing/unset
  • Set to NULL.
Define this default value through any of the following methods:
  • Set a header to a default value when the header is missing or its value is set to NULL.
    Syntax: %{<FEATURE VARIABLE>:=<DEFAULT VALUE>}
    Example: The following value sets the Referer header to unspecified when it is either missing or set to NULL. No action will take place if it has been set.
    %{http_referer:=unspecified}
  • Set a header to a default value when it is missing.
    Syntax: %{<FEATURE VARIABLE>=<DEFAULT VALUE>}
    Example: The following value sets the Referer header to unspecified when it is missing. No action will take place if it has been set.
    %{http_referer=unspecified}
  • Set the header to a default value when it does not meet any of the following conditions:
    • Missing header.
    • Set to NULL.
    Syntax: %{<FEATURE VARIABLE>:+<DEFAULT VALUE>}
    Example: The following value sets the Referer header to unspecified when a value has been assigned to it. No action will take place if it has been set.
    %{http_referer:+unspecified}

Manipulating Variables

Variables can be manipulated in the following ways:
  • Expanding substrings
  • Removing patterns

Substring Expansion

By default, a variable will expand to its full value. Use the following syntax to only expand a substring of the variable’s value:
%{<VARIABLE>:<OFFSET>:<LENGTH>}
Key information:
  • The value assigned to the <OFFSET> term determines the starting character of the substring.
    • Positive: The starting character of the substring is calculated from the first character in the string.
    • Zero: The starting character of the substring is the first character in the string.
    • Negative: The starting character of the substring is calculated from the last character in the string.
  • The length of the substring is determined by the <LENGTH> term.
    • Omitted: Omitting the <LENGTH> term allows the substring to include all characters between the starting character and the end of the string.
    • Positive: Determines the length of the substring from the starting character to the right.
    • Negative: Determines the length of the substring from the starting character to the left.
Example:
This example relies on the following sample request URL: https://cdn.mydomain.com/folder/marketing/myconsultant/proposal.html
The following string demonstrates various methods for manipulating variables: https://www%{http_host:3}/mobile/%{request_uri:7:10}/%{request_uri:-5:-8}.htm
Based on the sample request URL, the above variable manipulation will produce the following value: https://www.mydomain.com/mobile/marketing/proposal.htm

Pattern Removal

Text that matches a specific pattern can be removed from either the beginning or the end of a variable’s value.
  • Remove text when the specified pattern is found at the beginning of a variable’s value.
    %{<VARIABLE>#<PATTERN>}
  • Remove text when the specified pattern is found at the end of a variable’s value.
    %{<VARIABLE>%<PATTERN>}

Find And Replace

Find and replace syntax is described below.
  • Find and replace first occurrence of the specified pattern.
    Syntax: %{<VARIABLE>/<FIND>/<REPLACE>}
  • Find and replace all occurrences of the specified pattern.
    Syntax: %{<VARIABLE>//<FIND>/<REPLACE>}
  • Convert the entire value to upper-case.
    Syntax: %{<VARIABLE>^}
  • Convert the first occurrence of the specified pattern to upper-case.
    Syntax: %{<VARIABLE>^<FIND>}
  • Convert the entire value to lower-case.
    Syntax: %{<VARIABLE>,}
  • Convert the first occurrence of the specified pattern to lower-case.
    Syntax: %{<VARIABLE>,<FIND>}
Key information:
  • Expand text that matches the specified pattern by specifying a dollar sign followed by a whole integer (e.g., $1).
  • Multiple patterns may be specified. The order in which the pattern is specified determines the integer that will be assigned to it.
    In the following example, the first pattern matches www or www followed by a single digit, the second pattern matches the second-level domain, and the third pattern matches the top-level domain.
    %{host/=^(www\d?)\.([^\.]+)\.([^\.:]+)/cdn.$2.$3:80}
  • The rewritten value can consist of any combination of text and these placeholders.
    In the above example, the hostname will be rewritten according to this pattern: cdn.$2.$3:80 (e.g., cdn.mydomain.com:80).
  • The case of a pattern placeholder (e.g., $1) can be modified through the following flags:
    • U: Upper-case the expanded value.
      Sample syntax: %{host/=^(www\d?)\.([^\.]+)\.([^\.:]+)/cdn.$U2.$3:80}
    • L: Lower-case the expanded value.
      Sample syntax: %{host/=^(www\d?)\.([^\.]+)\.([^\.:]+)/cdn.$L2.$3:80}
  • An operator must be specified before the pattern. The specified operator determines the pattern capturing behavior:
    • = indicates that all occurrences of the specified pattern must be captured and rewritten. ^ indicates that only text that starts with the specified pattern will be captured. $ indicates that only text that ends with the specified pattern will be capture.
  • Omitting the /<REWRITE> value will result in the deletion of the text that matches the pattern.