set_variable
- Property Manager name: Set Variable
- Behavior version: The
v2024-08-13
rule format supports theset_variable
behavior v1.7. - 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.
Option | Type | Description | Requires | |
---|---|---|---|---|
variable_name | string (variable name) | Specifies the predeclared root name of the variable to modify. When you declare a variable name such as | {"displayType":"string","tag":"input","type":"text"} | |
value_source | enum | 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_value | string (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 | value_source is EXPRESSION | {"displayType":"string","tag":"input","type":"text"} {"if":{"attribute":"valueSource","op":"eq","value":"EXPRESSION"}} |
extract_location | enum | 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_name | enum | 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 | |||
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 | |||
NOT_AFTER | The end of the time range, expressed in | |||
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 | |||
COUNT | The number of client certificates received. | |||
STATUS_MSG | A short message indicating the status of a certificate's validation, such as | |||
KEY_LENGTH | The size of the key in bits. | |||
header_name | string (allows variables) | 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_name | string (allows variables) | 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"}} |
set_cookie_name | string (allows variables) | Specifies the name of the origin's | extract_location is SET_COOKIE | {"displayType":"string","tag":"input","type":"text"} {"if":{"attribute":"extractLocation","op":"eq","value":"SET_COOKIE"}} |
cookie_name | string (allows variables) | Specifies the name of the cookie to extract. | extract_location is COOKIE | {"displayType":"string","tag":"input","type":"text"} {"if":{"attribute":"extractLocation","op":"eq","value":"COOKIE"}} |
location_id | enum | Specifies the | 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_offset | string (allows variables) | This specifies a portion of the path. The indexing starts from | extract_location is PATH_COMPONENT_OFFSET | {"displayType":"string","tag":"input","type":"text"} {"if":{"attribute":"extractLocation","op":"eq","value":"PATH_COMPONENT_OFFSET"}} |
query_parameter_name | string (allows variables) | 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"}} |
generator | enum | 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_bytes | number (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_number | number | Specifies the lower bound of the random number. | generator is RAND | {"displayType":"number","tag":"input","type":"number"} {"if":{"attribute":"generator","op":"eq","value":"RAND"}} |
max_random_number | number | Specifies the upper bound of the random number. | generator is RAND | {"displayType":"number","tag":"input","type":"number"} {"if":{"attribute":"generator","op":"eq","value":"RAND"}} |
transform | enum | 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","BASE_32_DECODE","BASE_32_ENCODE","BITWISE_AND","BITWISE_NOT","BITWISE_OR","BITWISE_XOR","DECIMAL_TO_HEX","DECRYPT","DIVIDE","ENCRYPT","EPOCH_TO_STRING","EXTRACT_PARAM","HASH","JSON_EXTRACT","HEX_TO_DECIMAL","HEX_DECODE","HEX_ENCODE","HMAC","LOWER","MD5","MINUS","MODULO","MULTIPLY","NORMALIZE_PATH_WIN","REMOVE_WHITESPACE","COMPRESS_WHITESPACE","SHA_1","SHA_256","STRING_INDEX","STRING_LENGTH","STRING_TO_EPOCH","SUBSTITUTE","SUBSTRING","SUBTRACT","TRIM","UPPER","BASE_64_URL_DECODE","BASE_64_URL_ENCODE","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. | |||
BASE_32_DECODE | String encoding. | |||
BASE_32_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. | |||
JSON_EXTRACT | JSONPath extraction from a variable. | |||
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. | |||
COMPRESS_WHITESPACE | Convert whitespace characters to spaces, then compress multiple space characters into only one. | |||
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. | |||
BASE_64_URL_DECODE | The same as | |||
BASE_64_URL_ENCODE | The same as | |||
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_one | string (allows variables) | Specifies an additional operand when the | transform is either: ADD , BITWISE_AND , BITWISE_OR , BITWISE_XOR , DIVIDE , MODULO , MULTIPLY , SUBTRACT , JSON_EXTRACT | {"displayType":"string","tag":"input","type":"text"} {"if":{"attribute":"transform","op":"in","value":["ADD","BITWISE_AND","BITWISE_OR","BITWISE_XOR","DIVIDE","MODULO","MULTIPLY","SUBTRACT","JSON_EXTRACT"]}} |
algorithm | enum | 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_key | string (allows variables) | Specifies the encryption hex key. For | transform is either: ENCRYPT , DECRYPT | {"displayType":"string","tag":"input","type":"text"} {"if":{"attribute":"transform","op":"in","value":["ENCRYPT","DECRYPT"]}} |
initialization_vector | string | Specifies a one-time number as an initialization vector. It needs to be 15 characters long for | transform is either: ENCRYPT , DECRYPT | {"displayType":"string","tag":"input","type":"text"} {"if":{"attribute":"transform","op":"in","value":["ENCRYPT","DECRYPT"]}} |
encryption_mode | enum | 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. | |||
nonce | string (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_bytes | boolean | 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_string | string | Specifies an optional format string for the conversion, using format codes such as | 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_name | string (allows variables) | Extracts the value for the specified parameter name from a string that contains key/value pairs. (Use | transform is EXTRACT_PARAM | {"displayType":"string","tag":"input","type":"text"} {"if":{"attribute":"transform","op":"eq","value":"EXTRACT_PARAM"}} |
separator | string | 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"}} |
min | number | Specifies a minimum value for the generated integer. | transform is HASH | {"displayType":"number","tag":"input","type":"number"} {"if":{"attribute":"transform","op":"eq","value":"HASH"}} |
max | number | 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_key | string (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_algorithm | enum | 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_version | enum | 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. | |||
ipv6Prefix | number (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"}} |
ipv4Prefix | number (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_string | string (allows variables) | Specifies a substring for which the returned value represents a zero-based offset of where it appears in the original string, or | transform is STRING_INDEX | {"displayType":"string","tag":"input","type":"text"} {"if":{"attribute":"transform","op":"eq","value":"STRING_INDEX"}} |
regex | string | 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"}} |
replacement | string (allows variables) | Specifies the replacement string. Reinsert grouped items from the match into the replacement using | transform is SUBSTITUTE | {"displayType":"string","tag":"input","type":"text"} {"if":{"attribute":"transform","op":"eq","value":"SUBSTITUTE"}} |
case_sensitive | boolean | 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_substitution | boolean | 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_index | number | Specifies the zero-based character offset at the start of the substring. Negative indexes specify the offset from the end of the string. Consider this example for a string of
| transform is SUBSTRING | {"displayType":"number","tag":"input","type":"number"} {"if":{"attribute":"transform","op":"eq","value":"SUBSTRING"}} |
end_index | number | 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. Consider this example for a string of
| transform is SUBSTRING | {"displayType":"number","tag":"input","type":"number"} {"if":{"attribute":"transform","op":"eq","value":"SUBSTRING"}} |
except_chars | string | 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_chars | string | 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_profile | enum | 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. |
Updated 17 days ago