I'm trying to append a header inside nginx that will say something like 'X-Time: 0.06 seconds' which basically will be the time since nginx connected with the client and nginx responded to the client.
Thanks.
I'm trying to append a header inside nginx that will say something like 'X-Time: 0.06 seconds' which basically will be the time since nginx connected with the client and nginx responded to the client.
Thanks.
From official docs: http://nginx.org/en/docs/http/ngx_http_core_module.html#var_request_time
$request_time request processing time in seconds with a milliseconds resolution (1.3.9, 1.2.6); time elapsed since the first bytes were read from the client
Since versions 1.3.9 and 1.2.6 in common variables. Before: only in ngx_http_log_module.
AFAIK, the short answer is you cannot. Nginx don't understand the $request_time
variable if you use something like this:
add_header X-Time '$request_time';