AScript syntax and variable reference
AScript is a programmable script for Application Load Balancer (ALB) that lets you create custom forwarding rules.
Syntax rules
Double quotation marks (") are not allowed in AScript. You must use single quotation marks (') for all string values.
Syntax | Rule |
Comment | Any text on a line that follows a pound sign (#) is considered a comment. For example: |
Identifier |
|
Data type |
|
Variable |
|
Operator |
|
Statement |
|
Function |
|
Built-in variables
The dollar sign (
$) before a built-in variable name is used only to identify it as a built-in variable and can be omitted without affecting its use.Built-in variables are read-only and cannot be used as an l-value. This means you cannot assign a value to a built-in variable.
Each AScript rule supports a maximum of 200 global variables. There is no limit on the number of local variables. To use more than 200 variables, define a custom function and use local variables within that function.
Variable name | Description | Equivalent Nginx variable |
$arg_{name} | The value of the | ngx.var.arg_{name} The hyphens (-) in |
$http_{name} | The value of | ngx.var.http_{name} Hyphens (-) in |
$cookie_{name} | The value of | ngx.var.cookie_{name} Hyphens (-) in |
$scheme | The protocol. | ngx.var.scheme |
$server_protocol | The protocol version. | ngx.var.server_protocol |
$host | The host name from the request. | ngx.var.host |
$uri | The raw request URI. | ngx.var.raw_uri |
$args |
| ngx.var.args |
$request_method | The request method. | ngx.var.request_method |
$request_uri | The content of | ngx.var.request_uri |
$remote_addr | The client IP address. | ngx.var.remote_addr |