Response headers

In a similar fashion, you are allowed to access the HTTP headers of the response that was sent to the client. These variables are not available at all times—they will only carry a value after the response is sent, for instance, at the time of writing messages in the logs:

Variable

Description

$sent_http_content_type

Value of the Content-Type HTTP header, indicating the MIME type of the resource being transmitted.

$sent_http_content_length

Value of the Content-Length HTTP header informing the client of the response body length.

$sent_http_location

Value of the Location HTTP header, which indicates that the location of the desired resource is different from the one specified in the original request. ...

Get Nginx HTTP Server - Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.