Passing $upstream_response_time in a header

Maxim Dounin mdounin at
Thu Mar 9 14:03:49 UTC 2017


On Tue, Mar 07, 2017 at 04:38:04PM -0500, Jonathan Simowitz via nginx wrote:

> Hello,
> I have an nginx server that runs as reverse proxy and I would like to pass
> the $upstream_response_time value in a header. I find that when I do the
> value is actually a linux timestamp with millisecond resolution instead of
> a value of seconds with millisecond resolution. Apparently this is
> automatically converted when written to the logs. Is there a way to trigger
> the conversion for passing in a header?

The $upstream_response_time variable is the full time of receiving 
the response from the upstream server.  When sending a response 
header full time is not yet known, and the variable will contain 

If you want to return something known when sending a response 
header, use $upstream_header_time instead.

Maxim Dounin

More information about the nginx mailing list