The backend server sets the Cache-Control
HTTP header but the frontend might manipulate it. For debugging it would be useful to see the Cache-Control
HTTP header as the backend had set it. Hence wondering, it it possible on the backend server to set custom (X-
) header that contains the same value as Cache-Control
?
I tried the following already:
more_set_headers "X-Backend-Cache-Control: $http_cache_control";
But that didn't work. No header has been added.
It's not an issue with more_set_headers
. The following worked:
more_set_headers "X-Backend-Cache-Control: test";
A header was added. But that was just a simple test to see headers can be set at all and not useful obviously.
You're looking for the
$sent_http_cache_control
variable. This will contain the response'sCache-Control
value, so:The
$http_
variables contain HTTP headers from the HTTP request, as shown in nginx documentation.I don't know if there is a way to refer to HTTP response headers in nginx.