I have some problem with access log combined with X-Accel-Redirect
requests. In my case I have Nginx set up as load-balancer to group of
application servers. These servers return some special header in every
request - I need to log value of this special header (lets call it
‘X-user’) in access log - also I do not want to expose this header to
the world (proxy_hide_header helps here).
Everything seems to work, but when there is X-Accel-Redirect request I
have empty field in access log because of subrequest
($upstream_http_x_special is cleared because of subrequest, if I
understand this mechanism correctly). How to make this work for every
request?
Yeah, I have tried this, but this way non x-accel-redirect requests must
be
handled in old way which means I have to use 2 fields in access log. Is
there any way to use only one field?
06-11-2011 22:15 użytkownik “Maxim D.” [email protected] napisał:
On Mon, Nov 07, 2011 at 06:42:09AM +0100, Kamil G. wrote:
Yeah, I have tried this, but this way non x-accel-redirect requests must be
handled in old way which means I have to use 2 fields in access log. Is
there any way to use only one field?
E.g. you may use different log format for internal location.
Maxim D.
application servers. These servers return some special header in every
Here is my config:
location / {
set $x_user $upstream_http_x_user;
On Mon, Nov 07, 2011 at 11:57:15AM +0100, Kamil G. wrote:
OK, thanks - it works.
One more question: I have to use this variables in quotes because
sometimes it resolves to just empty string and there is problem with
parsing such logs.
Why sometimes empty variables ends in single hyphen ("-", this is what
I allways want) in access log and sometimes its just empty string
("")?
Hyphen is used when variable isn’t found. Empty string - if it’s
found, but empty.
Hyphen is used when variable isn’t found. Empty string - if it’s
found, but empty.
I see that variable defined by user is always empty (no hyphen) even
if it is not defined in location section connected with request (but
defined somewhere else in nginx config - other location section not
some section which is inherited). Is it normal?
One more question: I have to use this variables in quotes because
sometimes it resolves to just empty string and there is problem with
parsing such logs.
Why sometimes empty variables ends in single hyphen ("-", this is what
I allways want) in access log and sometimes its just empty string
("")?
On Tue, Nov 08, 2011 at 12:18:29PM +0100, Kamil G. wrote:
Hyphen is used when variable isn’t found. Empty string - if it’s
found, but empty.
I see that variable defined by user is always empty (no hyphen) even
if it is not defined in location section connected with request (but
defined somewhere else in nginx config - other location section not
some section which is inherited). Is it normal?
Yes.
Maxim D.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.