HTTP variables

$request_port variable (HTTP)

Explicit port from the request-target authority, falling back to the Host field port when available. Not the socket port and may be empty; treat client authority as untrusted. Version: 1.29.3. OSS documentation; verify build. No positional directive arguments. Example is a partial configuration fragment for a disposable synthetic lab; not a production logging policy.

Formal Syntax & Structure

nginx syntaxnginx
$request_port

Working Example

Example Snippetnginx
# Partial http-context example: isolated synthetic requests only; no real user data.log_format lab_request_port escape=json '{"observed":"$request_port"}';
Nginx Reference