GuideReference
TrainingSupportCommunity
Reference

set_​variable

  • Property Manager name: Set Variable
  • Behavior version: The v2023-01-05 rule format supports the set_​variable behavior v1.5.
  • Rule format status: GA, stable
  • Access: Read/Write
  • Allowed in includes: Yes

Modify a variable to insert into subsequent fields within the rule tree. Use this behavior to specify the predeclared variable_​name and determine from where to derive its new value. Based on this value_​source, you can either generate the value, extract it from some part of the incoming request, assign it from another variable (including a set of built-in system variables), or directly specify its text. Optionally choose a transform function to modify the value once. See Support for variables for more information.

OptionTypeDescriptionRequires
variable_​namestring (variable name)

Specifies the predeclared root name of the variable to modify. When you declare a variable name such as VAR, its name is preprended with PMUSER_ and accessible in a user namespace, so that you invoke it in subsequent text fields within the rule tree as {{user.​PMUSER_​VAR}}. In deployed XML metadata, it appears as %(PMUSER_​VAR).

{"displayType":"string","tag":"input","type":"text"}
value_​sourceenum

Determines how you want to set the value.

{"displayType":"enum","options":["EXPRESSION","EXTRACT","GENERATE"],"tag":"select"}
EXPRESSION

Specify your own string expression.

EXTRACT

Extract it from another value.

GENERATE

Generate the value.

variable_​valuestring (allows variables)

This directly specifies the value to assign to the variable. The expression may include a mix of static text and other variables, such as new_filename.{{builtin.​AK_​EXTENSION}} to embed a system variable.

value_​source is EXPRESSION
{"displayType":"string","tag":"input","type":"text"}
{"if":{"attribute":"valueSource","op":"eq","value":"EXPRESSION"}}
extract_​locationenum

This specifies from where to get the value.

value_​source is EXTRACT
{"displayType":"enum","options":["CLIENT_CERTIFICATE","CLIENT_REQUEST_HEADER","COOKIE","EDGESCAPE","PATH_COMPONENT_OFFSET","QUERY_STRING","DEVICE_PROFILE","RESPONSE_HEADER","SET_COOKIE"],"tag":"select"}
{"if":{"attribute":"valueSource","op":"eq","value":"EXTRACT"}}
CLIENT_​CERTIFICATE

Client certificate.

CLIENT_​REQUEST_​HEADER

Client request header.

COOKIE

Cookie.

EDGESCAPE

For location or network data.

PATH_​COMPONENT_​OFFSET

Substring within the URL path.

QUERY_​STRING

A query parameter.

DEVICE_​PROFILE

For client device attributes.

RESPONSE_​HEADER

A response header.

SET_​COOKIE

Cookie.

certificate_​field_​nameenum

Specifies the certificate's content.

extract_​location is CLIENT_​CERTIFICATE
{"displayType":"enum","options":["VERSION","SERIAL","FINGERPRINT_MD5","FINGERPRINT_SHA1","FINGERPRINT_DYN","ISSUER_DN","SUBJECT_DN","NOT_BEFORE","NOT_AFTER","SIGNATURE_ALGORITHM","SIGNATURE","CONTENTS_DER","CONTENTS_PEM","CONTENTS_PEM_NO_LABELS","COUNT","STATUS_MSG","KEY_LENGTH"],"tag":"select"}
{"if":{"attribute":"extractLocation","op":"eq","value":"CLIENT_CERTIFICATE"}}
VERSION

The certificate's X509 version number.

SERIAL

The serial number, expressed in hex.

FINGERPRINT_​MD5

The hex-encoded MD5 fingerprint.

FINGERPRINT_​SHA1

The hex-encoded SHA1 fingerprint.

FINGERPRINT_​DYN

The hex-encoded fingerprint generated based on the SIGNATURE_​ALGORITHM.

ISSUER_​DN

The distinguished name field for the certificate's issuer.

SUBJECT_​DN

The distinguished name field for the user.

NOT_​BEFORE

The start of the time range, expressed in YYYY/MM/DD HH:MI:SS ZONE format, where the zone is optional.

NOT_​AFTER

The end of the time range, expressed in YYYY/MM/DD HH:MI:SS ZONE format, where the zone is optional.

SIGNATURE_​ALGORITHM

The algorithm used to generate the certificate's signature.

SIGNATURE

The certificate's signature, expressed in hex.

CONTENTS_​DER

The entire DER-encoded certificate, expressed in hex.

CONTENTS_​PEM

The PEM-formatted certificate encoded as a single line of base64 characters.

CONTENTS_​PEM_​NO_​LABELS

Same as CONTENTS_​PEM, but not including the certificate's header and footer.

COUNT

The number of client certificates received.

STATUS_​MSG

A short message indicating the status of a certificate's validation, such as ok or missing.

KEY_​LENGTH

The size of the key in bits.

header_​namestring

Specifies the case-insensitive name of the HTTP header to extract.

extract_​location is CLIENT_​REQUEST_​HEADER
{"displayType":"string","tag":"input","type":"text"}
{"if":{"attribute":"extractLocation","op":"eq","value":"CLIENT_REQUEST_HEADER"}}
response_​header_​namestring

Specifies the case-insensitive name of the HTTP header to extract.

extract_​location is RESPONSE_​HEADER
{"displayType":"string","tag":"input","type":"text"}
{"if":{"attribute":"extractLocation","op":"eq","value":"RESPONSE_HEADER"}}
location_​idenum

Specifies the X-Akamai-Edgescape header's field name. Possible values specify basic geolocation, various geographic standards, and information about the client's network. For details on Edge​Scape header fields, see the Edge​Scape User Guide.

extract_​location is EDGESCAPE
{"displayType":"enum","options":["GEOREGION","COUNTRY_CODE","REGION_CODE","CITY","DMA","PMSA","MSA","AREACODE","COUNTY","FIPS","LAT","LONG","TIMEZONE","ZIP","CONTINENT","NETWORK","NETWORK_TYPE","ASNUM","THROUGHPUT","BW"],"tag":"select"}
{"if":{"attribute":"extractLocation","op":"eq","value":"EDGESCAPE"}}
GEOREGION

Region.

COUNTRY_​CODE

ISO-3166 country code.

REGION_​CODE

ISO-3166 region code.

CITY

City.

DMA

Designated Market Area.

PMSA

Primary Metropolitan Statistical Area.

MSA

Metropolitan Statistical Area.

AREACODE

Area code.

COUNTY

County.

FIPS

Federal Information Processing System code.

LAT

Latitude.

LONG

Longitude.

TIMEZONE

Time zone.

ZIP

Zip code.

CONTINENT

Two-letter continent code.

NETWORK

Network name.

NETWORK_​TYPE

Network type.

ASNUM

Autonomous System Number.

THROUGHPUT

Tiered throughput level.

BW

Tiered bandwidth level.

path_​component_​offsetstring

This specifies a portion of the path. The indexing starts from 1, so a value of /path/to/nested/filename.​html and an offset of 1 yields path, and 3 yields nested. Negative indexes offset from the right, so -2 also yields nested.

extract_​location is PATH_​COMPONENT_​OFFSET
{"displayType":"string","tag":"input","type":"text"}
{"if":{"attribute":"extractLocation","op":"eq","value":"PATH_COMPONENT_OFFSET"}}
query_​parameter_​namestring

Specifies the name of the query parameter from which to extract the value.

extract_​location is QUERY_​STRING
{"displayType":"string","tag":"input","type":"text"}
{"if":{"attribute":"extractLocation","op":"eq","value":"QUERY_STRING"}}
generatorenum

This specifies the type of value to generate.

value_​source is GENERATE
{"displayType":"enum","options":["HEXRAND","RAND"],"tag":"select"}
{"if":{"attribute":"valueSource","op":"eq","value":"GENERATE"}}
HEXRAND

A random hex sequence.

RAND

A random number.

number_​of_​bytesnumber (1-16)

Specifies the number of random hex bytes to generate.

generator is HEXRAND
{"displayType":"number","max":[16],"min":[1],"tag":"input","type":"range"}
{"if":{"attribute":"generator","op":"eq","value":"HEXRAND"}}
min_​random_​numberstring (allows variables)

Specifies the lower bound of the random number.

generator is RAND
{"displayType":"string","tag":"input","type":"text"}
{"if":{"attribute":"generator","op":"eq","value":"RAND"}}
max_​random_​numberstring (allows variables)

Specifies the upper bound of the random number.

generator is RAND
{"displayType":"string","tag":"input","type":"text"}
{"if":{"attribute":"generator","op":"eq","value":"RAND"}}
transformenum

Specifies a function to transform the value. For more details on each transform function, see Set Variable: Operations.

{"displayType":"enum","options":["NONE","ADD","BASE_64_DECODE","BASE_64_ENCODE","BITWISE_AND","BITWISE_NOT","BITWISE_OR","BITWISE_XOR","DECIMAL_TO_HEX","DECRYPT","DIVIDE","ENCRYPT","EPOCH_TO_STRING","EXTRACT_PARAM","HASH","HEX_TO_DECIMAL","HEX_DECODE","HEX_ENCODE","HMAC","LOWER","MD5","MINUS","MODULO","MULTIPLY","NORMALIZE_PATH_WIN","REMOVE_WHITESPACE","SHA_1","SHA_256","STRING_INDEX","STRING_LENGTH","STRING_TO_EPOCH","SUBSTITUTE","SUBSTRING","SUBTRACT","TRIM","UPPER","URL_DECODE","URL_ENCODE","URL_DECODE_UNI","UTC_SECONDS","XML_DECODE","XML_ENCODE"],"tag":"select"}
NONE

No transformation.

ADD

Arithmetic function.

BASE_64_DECODE

String encoding.

BASE_64_ENCODE

String encoding.

BITWISE_​AND

Bitwise operation.

BITWISE_​NOT

Bitwise operation.

BITWISE_​OR

Bitwise operation.

BITWISE_​XOR

Bitwise operation.

DECIMAL_​TO_​HEX

Numeric conversion.

DECRYPT

String encoding.

DIVIDE

Arithmetic function.

ENCRYPT

String encoding.

EPOCH_​TO_​STRING

Time format.

EXTRACT_​PARAM

String format.

HASH

Integer data digest.

HEX_​TO_​DECIMAL

Numeric conversion.

HEX_​DECODE

String conversion.

HEX_​ENCODE

String conversion.

HMAC

Data digest.

LOWER

String function.

MD5

Data digest.

MINUS

Arithmetic function, reverse sign.

MODULO

Arithmetic function, get remainder.

MULTIPLY

Arithmetic function.

NORMALIZE_​PATH_​WIN

Convert Windows paths to Unix format and remove relative path syntax.

REMOVE_​WHITESPACE

String conversion.

SHA_1

Data digest.

SHA_256

Data digest.

STRING_​INDEX

String function: locate substring.

STRING_​LENGTH

String function.

STRING_​TO_​EPOCH

Time format.

SUBSTITUTE

String function.

SUBSTRING

String function: locate index.

SUBTRACT

Arithmetic function.

TRIM

Trim surrounding whitespace in string.

UPPER

String function.

URL_​DECODE

String conversion.

URL_​ENCODE

Unicode string conversion.

URL_​DECODE_​UNI

String conversion.

UTC_​SECONDS

Time format.

XML_​DECODE

String conversion.

XML_​ENCODE

String conversion.

operand_​onestring (allows variables)

Specifies an additional operand when the transform function is set to various arithmetic functions (ADD, SUBTRACT, MULTIPLY, DIVIDE, or MODULO) or bitwise functions (BITWISE_​AND, BITWISE_​OR, or BITWISE_​XOR).

transform is either: ADD, BITWISE_​AND, BITWISE_​OR, BITWISE_​XOR, DIVIDE, MODULO, MULTIPLY, SUBTRACT
{"displayType":"string","tag":"input","type":"text"}
{"if":{"attribute":"transform","op":"in","value":["ADD","BITWISE_AND","BITWISE_OR","BITWISE_XOR","DIVIDE","MODULO","MULTIPLY","SUBTRACT"]}}
algorithmenum

Specifies the algorithm to apply.

transform is either: ENCRYPT, DECRYPT
{"displayType":"enum","options":["ALG_3DES","ALG_AES128","ALG_AES256"],"tag":"select"}
{"if":{"attribute":"transform","op":"in","value":["ENCRYPT","DECRYPT"]}}
ALG_3DES

Triple DES.

ALG_​AES128

Advanced Encryption Standard, 128 bits.

ALG_​AES256

Advanced Encryption Standard, 256 bits.

encryption_​keystring (allows variables)

Specifies the encryption hex key. For ALG_3DES it needs to be 48 characters long, 32 characters for ALG_​AES128, and 64 characters for ALG_​AES256.

transform is either: ENCRYPT, DECRYPT
{"displayType":"string","tag":"input","type":"text"}
{"if":{"attribute":"transform","op":"in","value":["ENCRYPT","DECRYPT"]}}
initialization_​vectorstring

Specifies a one-time number as an initialization vector. It needs to be 15 characters long for ALG_3DES, and 32 characters for both ALG_​AES128 and ALG_​AES256.

transform is either: ENCRYPT, DECRYPT
{"displayType":"string","tag":"input","type":"text"}
{"if":{"attribute":"transform","op":"in","value":["ENCRYPT","DECRYPT"]}}
encryption_​modeenum

Specifies the encryption mode.

transform is either: ENCRYPT, DECRYPT
{"displayType":"enum","options":["CBC","ECB"],"tag":"select"}
{"if":{"attribute":"transform","op":"in","value":["ENCRYPT","DECRYPT"]}}
CBC

Cipher Block Chaining.

ECB

Electronic Codebook.

noncestring (allows variables)

Specifies the one-time number used for encryption.

transform is either: ENCRYPT, DECRYPT
{"displayType":"string","tag":"input","type":"text"}
{"if":{"attribute":"transform","op":"in","value":["ENCRYPT","DECRYPT"]}}
prepend_​bytesboolean

Specifies a number of random bytes to prepend to the key.

transform is either: ENCRYPT, DECRYPT
{"displayType":"boolean","tag":"input","type":"checkbox"}
{"if":{"attribute":"transform","op":"in","value":["ENCRYPT","DECRYPT"]}}
format_​stringstring

Specifies an optional format string for the conversion, using format codes such as %m/%d/%y as specified by strftime. A blank value defaults to RFC-2616 format.

transform is either: EPOCH_​TO_​STRING, STRING_​TO_​EPOCH
{"displayType":"string","tag":"input","type":"text"}
{"if":{"attribute":"transform","op":"in","value":["EPOCH_TO_STRING","STRING_TO_EPOCH"]}}
param_​namestring (allows variables)

Extracts the value for the specified parameter name from a string that contains key/value pairs. (Use separator below to parse them.)

transform is EXTRACT_​PARAM
{"displayType":"string","tag":"input","type":"text"}
{"if":{"attribute":"transform","op":"eq","value":"EXTRACT_PARAM"}}
separatorstring

Specifies the character that separates pairs of values within the string.

transform is EXTRACT_​PARAM
{"displayType":"string","tag":"input","type":"text"}
{"if":{"attribute":"transform","op":"eq","value":"EXTRACT_PARAM"}}
minnumber

Specifies a minimum value for the generated integer.

transform is HASH
{"displayType":"number","tag":"input","type":"number"}
{"if":{"attribute":"transform","op":"eq","value":"HASH"}}
maxnumber

Specifies a maximum value for the generated integer.

transform is HASH
{"displayType":"number","tag":"input","type":"number"}
{"if":{"attribute":"transform","op":"eq","value":"HASH"}}
hmac_​keystring (allows variables)

Specifies the secret to use in generating the base64-encoded digest.

transform is HMAC
{"displayType":"string","tag":"input","type":"text"}
{"if":{"attribute":"transform","op":"eq","value":"HMAC"}}
hmac_​algorithmenum

Specifies the algorithm to use to generate the base64-encoded digest.

transform is HMAC
{"displayType":"enum","options":["SHA1","SHA256","MD5"],"tag":"select"}
{"if":{"attribute":"transform","op":"eq","value":"HMAC"}}
SHA1

SHA-1.

SHA256

SHA-256.

MD5

MD5.

ip_​versionenum

Specifies the IP version under which a subnet mask generates.

transform is NETMASK
{"displayType":"enum","options":["IPV4","IPV6"],"tag":"select"}
{"if":{"attribute":"transform","op":"eq","value":"NETMASK"}}
IPV4

Use IPv4.

IPV6

Use IPv6.

ipv6Prefixnumber (0-128)

Specifies the prefix of the IPV6 address, a value between 0 and 128.

ip_​version is IPV6
{"displayType":"number","max":[128],"min":[0],"tag":"input","type":"range"}
{"if":{"attribute":"ipVersion","op":"eq","value":"IPV6"}}
ipv4Prefixnumber (0-32)

Specifies the prefix of the IPV4 address, a value between 0 and 32.

ip_​version is IPV4
{"displayType":"number","max":[32],"min":[0],"tag":"input","type":"range"}
{"if":{"attribute":"ipVersion","op":"eq","value":"IPV4"}}
sub_​stringstring (allows variables)

Specifies a substring for which the returned value represents a zero-based offset of where it appears in the original string, or -1 if there's no match.

transform is STRING_​INDEX
{"displayType":"string","tag":"input","type":"text"}
{"if":{"attribute":"transform","op":"eq","value":"STRING_INDEX"}}
regexstring

Specifies the regular expression pattern (PCRE) to match the value.

transform is SUBSTITUTE
{"displayType":"string","tag":"input","type":"text"}
{"if":{"attribute":"transform","op":"eq","value":"SUBSTITUTE"}}
replacementstring (allows variables)

Specifies the replacement string. Reinsert grouped items from the match into the replacement using $1, $2 ... $n.

transform is SUBSTITUTE
{"displayType":"string","tag":"input","type":"text"}
{"if":{"attribute":"transform","op":"eq","value":"SUBSTITUTE"}}
case_​sensitiveboolean

Enabling this makes all matches case sensitive.

transform is either: EXTRACT_​PARAM, SUBSTITUTE
{"displayType":"boolean","tag":"input","type":"checkbox"}
{"if":{"attribute":"transform","op":"in","value":["EXTRACT_PARAM","SUBSTITUTE"]}}
global_​substitutionboolean

Replaces all matches in the string, not just the first.

transform is SUBSTITUTE
{"displayType":"boolean","tag":"input","type":"checkbox"}
{"if":{"attribute":"transform","op":"eq","value":"SUBSTITUTE"}}
start_​indexstring

Specifies the zero-based character offset at the start of the substring. Negative indexes specify the offset from the end of the string.

transform is SUBSTRING
{"displayType":"string","tag":"input","type":"text"}
{"if":{"attribute":"transform","op":"eq","value":"SUBSTRING"}}
end_​indexstring

Specifies the zero-based character offset at the end of the substring, without including the character at that index position. Negative indexes specify the offset from the end of the string.

transform is SUBSTRING
{"displayType":"string","tag":"input","type":"text"}
{"if":{"attribute":"transform","op":"eq","value":"SUBSTRING"}}
except_​charsstring

Specifies characters not to encode, possibly overriding the default set.

transform is URL_​ENCODE
{"displayType":"string","tag":"input","type":"text"}
{"if":{"attribute":"transform","op":"eq","value":"URL_ENCODE"}}
force_​charsstring

Specifies characters to encode, possibly overriding the default set.

transform is URL_​ENCODE
{"displayType":"string","tag":"input","type":"text"}
{"if":{"attribute":"transform","op":"eq","value":"URL_ENCODE"}}
device_​profileenum

Specifies the client device attribute. Possible values specify information about the client device, including device type, size and browser. For details on fields, see Device Characterization.

extract_​location is DEVICE_​PROFILE
{"displayType":"enum","options":["IS_MOBILE","IS_TABLET","IS_WIRELESS_DEVICE","PHYSICAL_SCREEN_HEIGHT","PHYSICAL_SCREEN_WIDTH","RESOLUTION_HEIGHT","RESOLUTION_WIDTH","VIEWPORT_WIDTH","BRAND_NAME","DEVICE_OS","DEVICE_OS_VERSION","DUAL_ORIENTATION","MAX_IMAGE_HEIGHT","MAX_IMAGE_WIDTH","MOBILE_BROWSER","MOBILE_BROWSER_VERSION","PDF_SUPPORT","COOKIE_SUPPORT"],"tag":"select"}
{"if":{"attribute":"extractLocation","op":"eq","value":"DEVICE_PROFILE"}}
IS_​MOBILE

Basic device attributes, boolean.

IS_​TABLET

Basic device attributes, boolean.

IS_​WIRELESS_​DEVICE

Basic device attributes, boolean.

PHYSICAL_​SCREEN_​HEIGHT

Device screen size in millimeters.

PHYSICAL_​SCREEN_​WIDTH

Device screen size in millimeters.

RESOLUTION_​HEIGHT

Device screen size in pixels.

RESOLUTION_​WIDTH

Device screen size in pixels.

VIEWPORT_​WIDTH

Device viewport size in millimeters.

BRAND_​NAME

Basic device attributes, string values.

DEVICE_​OS

Basic device attributes, string values.

DEVICE_​OS_​VERSION

Basic device attributes, string values.

DUAL_​ORIENTATION

Whether the display adapts to portrait/landscape orientation.

MAX_​IMAGE_​HEIGHT

Maximum image size that can be displayed, in pixels.

MAX_​IMAGE_​WIDTH

Maximum image size that can be displayed, in pixels.

MOBILE_​BROWSER

Basic device attributes, string values.

MOBILE_​BROWSER_​VERSION

Basic device attributes, string values.

PDF_​SUPPORT

Device support capabilities, boolean.

COOKIE_​SUPPORT

Device support capabilities, boolean.