Welcome! Log In Create A New Profile

Advanced

Re: header handling

Frank Liu
August 14, 2015 04:06PM
Thanks ryd994 for the suggestion! 1 and 2 are working now.
Anyone else has any ideas on 3?

Frank

On Fri, Aug 14, 2015 at 10:36 AM, ryd994 <ryd994@163.com> wrote:

> Hi,
>
> 1) Use mapped variable
>
> map $http_<header you want to change> $<some variable name> {
> "" "value if nit set";
> default $http_<header you want to change>;
> }
> Then you can set header with the new variable.
>
> 2) I guess you can use map, too. Use $upstream_http_*name* instead.
>
> 3) Sorry, I have no idea on this.
>
> On Sat, Aug 15, 2015, 00:51 Frank Liu <gfrankliu@gmail.com> wrote:
>
>> Hi,
>>
>> I have a few questions regarding headers in nginx:
>>
>> 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?
>>
>> 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.
>>
>> 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?
>>
>> Thanks!
>> Frank
>> _______________________________________________
>> nginx mailing list
>> nginx@nginx.org
>> http://mailman.nginx.org/mailman/listinfo/nginx
>
>
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

header handling

Frank Liu August 14, 2015 12:52PM

Re: header handling

ryd994 August 14, 2015 01:38PM

Re: header handling

Frank Liu August 14, 2015 04:06PM

Re: header handling

Frank Liu August 15, 2015 03:18AM

Re: header handling

Maxim Dounin August 17, 2015 07:32AM

Re: header handling

Frank Liu August 17, 2015 07:40PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 155
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