All Products
Search
Document Center

Server Load Balancer:AScript built-in variables

Last Updated:Apr 01, 2026

AScript is a programmable scripting feature for Application Load Balancer (ALB) that lets you configure forwarding rules beyond what the ALB console supports. This page lists all AScript built-in variables and their corresponding NGINX variables.

Built-in variables

Request parameters

Built-in variableDescriptionNGINX variable
$arg_{name}Value of the {name} parameter in the query string. Hyphens (-) in {name} must be replaced with underscores (_). For example, use $arg_x_user_id to read the X-USER-ID parameter.ngx.var.arg_{name}
$argsThe full query string, excluding the leading ?. For example, for the URL http://www.a.com/1k.file?k1=v1&k2=v2, $args returns k1=v1&k2=v2. To read a single parameter, use $arg_{name} instead.ngx.var.args

Request headers and cookies

Built-in variableDescriptionNGINX variable
$http_{name}Value of the {name} field in the request header. Hyphens (-) in {name} must be replaced with underscores (_). For example, use $http_x_user_id to read the X-USER-ID header.ngx.var.http_{name}
$cookie_{name}Value of the {name} field in the cookie header. Hyphens (-) in {name} must be replaced with underscores (_). For example, use $cookie_x_user_id to read the X-USER-ID cookie.ngx.var.cookie_{name}

Request line and URI

Built-in variableDescriptionNGINX variable
$request_methodThe HTTP method of the request.ngx.var.request_method
$request_uriThe full original request URI, including the query string — equivalent to $uri + "?" + $args. Use $request_uri when you need the complete URI with parameters; use $uri if you only need the path.ngx.var.request_uri
$uriThe original URI.ngx.var.raw_uri
$hostThe original host.ngx.var.host
$schemeThe protocol type.ngx.var.scheme
$server_protocolThe version of the protocol.ngx.var.server_protocol

Client information

Built-in variableDescriptionNGINX variable
$remote_addrThe IP address of the client sending the request.ngx.var.remote_addr

Usage notes

  • The dollar sign ($) identifies a variable as a built-in variable. Remove it if your business logic requires the variable name without the prefix.

  • Do not assign values to built-in variables in the same way as parameters.

  • A script supports at most 200 global variables. Local variables are unlimited. To use more than 200 global variables, define a custom function and declare the excess variables as local variables inside the function.