Variables
6 methodsCommonly used built-in variables available in the http context.
$hostLowercase host name from the request line, or Host header, or server name matched.
Returns
string
Example
nginx
add_header X-Served-For $host;$request_uriFull original request URI including query string, unmodified.
Returns
string
Example
nginx
return 301 https://$host$request_uri;$remote_addrClient IP address of the connection.
Returns
string
Example
nginx
log_format main '$remote_addr - $remote_user [$time_local] "$request"';$args | $query_stringFull query string from the request line; identical values.
Returns
string
Example
nginx
if ($args ~* ^debug=1) { add_header X-Debug on; }$schemeRequest scheme: http or https.
Returns
string
Example
nginx
return 301 $scheme://example.com$request_uri;$http_<name>Value of the request header whose lowercased name with dashes replaced by underscores is <name>.
Parameters
| Name | Type | Description |
|---|---|---|
| name | string | Header name with dashes converted to underscores (e.g. x_request_id for X-Request-Id). |
Returns
string
Example
nginx
proxy_set_header X-Request-Id $http_x_request_id;