Prev: Next: Up: String Expansions[Contents][Index]


11.3.2 Request Accessor Interpretation

Request accessor is a syntactical construct of the form:

%[name]

where name denotes a part of the incoming request or configuration setting to access and square brackets are part of the construct. Accessors are interpreted and replaced with the value of the corresponding part of the request. Some accessors take an argument, which is specified after accessor name and is delimited from it by one or more whitespace characters.

The following accessors are defined:

Accessor: const name [encode]

Configuration constant name (see Providing constants for Lua code). Optional encode defines the encoding in which to represent it. Its possible values are:

none

Don’t encode it. This is the default if no encode argument is present.

url

Encode the value using percent-encoding (RFC 3986).

base64

Encode the value using base64 encoding (RFC 3548).

Accessor: url

Request URL.

Accessor: path

Request path.

Accessor: query

Query part.

Accessor: param name

The value of the query parameter name.

Accessor: header name

The value of HTTP header name.

Accessor: host

Hostname part of the Host header. If the latter does not include port number, it is equivalent to %[header host].

Accessor: port

If the value of the Host header includes port number, ‘%[port]’ expands to port number with the leading colon character. Otherwise, it expands to empty string.

Accessor: remoteip fwd

Expands to the request originator IP address. If fwd is 0, expands to its real IP, otherwise expands to the IP determined from the X-Forwarded-For (or similar) header. See %a, for details.

Accessor: user

If the request bears the Authorization: Basic header, expands to the user name extracted from its value. Otherwise, its expansion is empty.


Prev: Next: Up: String Expansions[Contents][Index]