3

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.

Angelo Vargas
  • 153
  • 1
  • 6

2 Answers2

1

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';
quanta
  • 50,327
  • 19
  • 152
  • 213
1

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.

eagleas
  • 26
  • 2