Welcome! Log In Create A New Profile

Advanced

Re: wrong values for $upstream_response_time in add_header?

Maxim Dounin
May 04, 2012 06:52AM
Hello!

On Fri, May 04, 2012 at 10:19:49AM +0200, Christian Bönning wrote:

> I'm cross-posting this from the forums to the mailinglist in hope for
> getting a reply here. Sorry for that.
>
> I'm using nginx-1.2.0 (plus upstream-fair and headers-more; for
> complete `nginx -V` and `uname -a` please see
> https://gist.github.com/be4a86dbfdae516a4efe) and I'm really happy
> with that. However I want to add a couple of Headers
> ($upstream_response_time in this case) to be passed to the Client for
> debugging purposes. So I've added `add_header X-AppServer-Response
> $upstream_response_time;` to my location block where I do all my proxy
> stuff. I've got an upstream block where I've put in my 3 backend
> servers. All Backends respond very fast during testing.
>
> However there are unreasonable high values within this header
> (X-AppServer-Response: 74768.562 in this case). I'm using access_log
> to get some more values written to disk as well for central
> monitoring. Within this log all values seem to be ok (for this
> particular request it's 0.002 to be exact).
>
> I was able to reproduce that behaviour using different backends
> (apache2 and another nginx in this case).
>
> Any Idea what's going wrong here?

The $upstream_response_time is only meaningful once response is
fully got from upstream, and this happens after response headers
are got (and sent to client). That is, you basically can't use
$upstream_response_time in add_header, only in logs.

Maxim Dounin

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

wrong values for $upstream_response_time in add_header?

hexa May 04, 2012 04:20AM

Re: wrong values for $upstream_response_time in add_header?

Maxim Dounin May 04, 2012 06:52AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 149
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready