This topic describes EdgeScript built-in variables and the corresponding NGINX variables.
The dollar sign ($) before a variable is used to specify that the variable is a built-in variable. You can remove the dollar sign based on your business requirements.
Do not assign values to built-in variables in the same way as parameters.
You can specify at most 200 variables in a script. To use more than 200 variables, split the function.
The following table describes the EdgeScript built-in variables.
Built-in variable | Description | NGINX variable |
$arg_{name} | The value of the | $arg_ Note If the |
$http_{name} | The value of the name field in the request header. | $http_ Note Hyphens (-) in the |
$cookie_{name} | The value of the name field in the request cookie header. | $cookie_ Note If the |
$scheme | The protocol type. | $scheme |
$server_protocol | The protocol version. | $server_protocol |
$host | The original host. | $host |
$uri | The original URI. | None |
$args |
| $args |
$request_method | The request method. | $request_method |
$request_uri | The content of | $request_uri |
$remote_addr | The IP address used by the client to connect to points of presence (POPs). | $remote_addr |
Splitting function
When your rule contains more than 200 variables, split the original function into multiple user-defined functions. Ensure that each user-defined function contains no more than 200 variables.
The following shows an example:
#If variables exceed the limit, split them like this:
def judeg_arg() {
#Parameter judgment related logic
x
x
}
def judeg_time() {
#Time judgment related logic
x
x
}
def judeg_token() {
#Encryption judgment related logic
x
x
}
judeg_arg()
judeg_time()
judeg_token()