All Products
Search
Document Center

Edge Security Acceleration:EdgeScript built-in variables

Last Updated:Jun 16, 2026

This topic describes the built-in variables available in EdgeScript and their corresponding NGINX variables.

The following table describes the EdgeScript built-in variables.
Built-in variableDescriptionNGINX variable
$arg_{name}The value of the name parameter in the query string. A query string contains the request parameters of an HTTP request.$arg_
Note If {name} contains a hyphen (-), use the req_uri_arg function to retrieve the value instead of the $arg_ variable. For example, for the request http://example.com/1.jpg?example-demo=123, use the function req_uri_arg('example-demo') to get the value.
$http_{name}The value of the specified request header.$http_
Note If {name} contains a hyphen (-), you must replace it with an underscore (_). For example, to access the X-USER-ID header, use the variable $http_x_user_id.
$cookie_{name}The value of the {name} cookie from the request cookie header.$cookie_
Note If {name} contains a hyphen (-), use the req_cookie function to retrieve the value instead of the $cookie_ variable. For example, to get the value from a request with the cookie:example-demo=123 header, use the function req_cookie('example-demo').
$schemeThe protocol type, such as http or https.$scheme
$server_protocolThe protocol version, such as HTTP/1.1.$server_protocol
$hostThe original host from the request header.$host
$uriThe original URI of the request, which excludes the query string.None
$args$args represents all request parameters as a single string, excluding the question mark (?). For example, for the request http://example.aliyundoc.com/1k.file?k1=v1&k2=v2:
  • $arg_k1 retrieves the value v1.
  • $args retrieves the entire request parameter string: k1=v1&k2=v2?.
$args
$request_methodThe request method, such as GET or POST.$request_method
$request_uriThe full original request URI, including the path and query string. This is equivalent to uri + '?' + args.$request_uri
$remote_addrThe client IP address (the first IP address in the x-forwarded-for request header).$remote_addr
Note
  • The dollar sign ($) prefix on built-in variables provides clarity and can be omitted.
  • Built-in variables are read-only and cannot be assigned new values.
  • Each EdgeScript rule supports a maximum of 200 global variables. There is no limit on local variables. If you need to exceed the global variable limit, define a custom function and use local variables within it.