The proxy module offers several variables that can be inserted in various locations, for example, in the proxy_set_header directive or in the logging-related directives such as log_format. The available variables are:
- $proxy_host: Contains the hostname of the backend server used for the current request.
- $proxy_port: Contains the port of the backend server used for the current request.
- $proxy_add_x_forwarded_for: This variable contains the value of the X-Forwarded-For request header, followed by the remote address of the client. Both values are separated by a comma. If the X-Forwarded-For request header is unavailable, the variable only contains the client remote address.
- $proxy_internal_body_length: Length of the request body (set ...