This topic describes EdgeScript built-in variables and the corresponding NGINX variables.
Note
- 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 global variables and an unlimited number of local variables in a script. To specify more than 200 global variables in a script, create a custom function and use the global variables as local variables in the function.
The following table describes the EdgeScript built-in variables.
Built-in variable | Description | NGINX variable |
---|---|---|
$arg_{name} | The value of the name parameter in the Query String . The Query String represents request parameters in an HTTP request.
|
$arg_
Note Hyphens (-) in the
{name} field must be replaced by underscores (_). For example, X-USER-ID must be changed to $arg_x_user_id .
|
$http_{name} | The value of the name field in the request header. | $http_
Note Hyphens (-) in the
{name} field must be replaced by underscores (_). For example, X-USER-ID must be changed to $http_x_user_id .
|
$cookie_{name} | The value of the name field in the request cookie header. | $cookie_
Note Hyphens (-) in the
{name} field must be replaced by underscores (_). For example, X-USER-ID must be changed to $cookie_x_user_id .
|
$scheme | The protocol. | $scheme |
$server_protocol | The version of the protocol. | $server_protocol |
$host | The original host. | $host |
$uri | The original URI. | N/A |
$args | $args represents all request parameters in an HTTP request, excluding question marks (? ). For example, in the URI of the request http://www.example.com/1k.file?k1=v1&k2=v2 , $args is used to return the entire Query String: k1=v1&k2=v2 .
Note You can also use
$arg_k1 to acquire the value of the k1 parameter: v1 .
|
$args |
$request_method | The request method. | $request_method |
$request_uri | The request URI, which is the content of uri+'?'+ args .
|
$request_uri |
$remote_addr | The IP address of the client. | $remote_addr |