Forum: NGINX "add_header X-Upstream-Response-Time $upstream_response_time" not working

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Matt Albright (Guest)
on 2008-10-08 22:04
(Received via mailing list)
I'm using nginx 0.5.35 (I know, we'll upgrade here soon) and have
$upstream_response_time in the access log, and it works great.

To track down a problem, I wanted to add a header to nginx's response
that shows
the response time of the upstream server, so I tried:

add_header X-Upstream-Response-Time $upstream_response_time

Which seems like it would work, based on the docs for add_header, but I
get:

X-Upstream-Response-Time: 1223488205.821

Which looks like a unix time to me, which isn't very useful.

Is there any way to get what I want?  I tried putting the add_header in
http,
server, and location blocks, but all of them gave me a unix time.

Thanks for any help you can offer.

matt
Maxim D. (Guest)
on 2008-10-08 23:04
(Received via mailing list)
Hello!

On Wed, Oct 08, 2008 at 05:55:16PM +0000, Matt Albright wrote:

>X-Upstream-Response-Time: 1223488205.821
>
>Which looks like a unix time to me, which isn't very useful.

Yep.  Since header is sent before we got whole response from
upstream - we have no upstream end time at this point.

>Is there any way to get what I want?  I tried putting the add_header in http,
>server, and location blocks, but all of them gave me a unix time.

Currently no, only logging will work.

Probably it's a good idea to introduce another variable that will
be available as soon as we got response header from upstream.

Maxim D.
Re:
Matt Albright (Guest)
on 2008-10-08 23:22
(Received via mailing list)
Maxim D. <mdounin@...> writes:
> Yep.  Since header is sent before we got whole response from
> upstream - we have no upstream end time at this point.

Oh well, guess I'll have to try something else.

Thanks for the quick response.

matt
This topic is locked and can not be replied to.