<div dir="ltr">I made the below patch and can now use $upstream_http_x_header for logformat to capture the header X.header in the access log. Does anybody see any issues with the patch?<div><br></div><div><p style="margin:0px;font-size:11px;font-family:Menlo">--- src/http/ngx_http_variables.c.orig<span class="Apple-tab-span" style="white-space:pre">       </span>2015-08-15 02:19:31.635328112 +0000</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">+++ src/http/ngx_http_variables.c<span class="Apple-tab-span" style="white-space:pre"> </span>2015-08-15 02:19:42.051541422 +0000</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">@@ -897,6 +897,8 @@</p>
<p style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px"> </p>
<p style="margin:0px;font-size:11px;font-family:Menlo">             } else if (ch == '-') {</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">                 ch = '_';</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">+            } else if (ch == '.') {</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">+                ch = '_';</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">             }</p>
<p style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px"> </p>
<p style="margin:0px;font-size:11px;font-family:Menlo">             if (var->data[n + prefix] != ch) {</p></div><div><br></div><div>Thanks!</div><div>Frank</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Aug 14, 2015 at 1:04 PM, Frank Liu <span dir="ltr"><<a href="mailto:gfrankliu@gmail.com" target="_blank">gfrankliu@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Thanks ryd994 for the suggestion!  1 and 2 are working now.<div>Anyone else has any ideas on 3?</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>Frank</div></font></span></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Aug 14, 2015 at 10:36 AM, ryd994 <span dir="ltr"><<a href="mailto:ryd994@163.com" target="_blank">ryd994@163.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">Hi,</p>
<p dir="ltr">1) Use mapped variable</p>
<p dir="ltr">map $http_<header you want to change> $<some variable name> {<br>
  ""           "value if nit set";<br>
  default $http_<header you want to change>;<br>
}<br>
Then you can set header with the new variable.</p>
<p dir="ltr">2) I guess you can use map, too. Use $upstream_http_<i>name</i> instead.</p>
<p dir="ltr">3) Sorry, I have no idea on this.</p>
<br><div class="gmail_quote"><div><div><div dir="ltr">On Sat, Aug 15, 2015, 00:51 Frank Liu <<a href="mailto:gfrankliu@gmail.com" target="_blank">gfrankliu@gmail.com</a>> wrote:<br></div></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div dir="ltr">Hi,<br><br>I have a few questions regarding headers in nginx:<br><br>1) I use proxy_set_header to pass a header to upstream servers. Is it possible to honor the header if the incoming request already has it?<br><br>2) I want to pass the "Server" header from upstream response to clients, and if there is no such response header, I'd like to add a customer one. Is it possible via core nginx or any third party modules? Currently I am using "proxy_pass_header Server" without any check. I am not sure what happens if upstream response doesn't have it.<br><br>3) I am trying to log an upstream response header to access log but it has a "dot" in it (say X.header). I don't have any control to the upstream servers. On nginx side, I tried setting "ignore_invalid_headers off" in the server block, and in the logformat, I tried a few things for the the column: $upstream_http_x.header   $upstream_http_x_header $upstream_http_x-header, but nothing works. Any ideas how I can log it?<br><br>Thanks!<br>Frank<br></div></div></div>
_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org" target="_blank">nginx@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" rel="noreferrer" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a></blockquote></div>
<br>_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org" target="_blank">nginx@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" rel="noreferrer" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a><br></blockquote></div><br></div>
</div></div></blockquote></div><br></div>