Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.


share|improve this question
To what purpose? Why does this response time have to be sent to the client via HTTP headers? – alphadogg Oct 14 '11 at 20:14
I can see this being very useful for debugging. – erikcw Oct 14 '11 at 21:14
What I meant was: what was the end goal, because response processing time could be had from the logs. Why send it in a header to the client? – alphadogg Oct 14 '11 at 23:01

From official docs:

$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.

share|improve this answer

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';
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.