Input Headers. - headers_more_module.
David | StyleFlare
david at styleflare.com
Thu Aug 30 20:12:57 UTC 2012
Thank You
So this worked.
The question is then if I am setting a value in /auth
When does it get actually set?
postgres_set $pg_server 0 0 required;
Then in my location block;
I do
more_set_input_headers 'X-Server-ID: $pg_server';
When is $pg_server actually set?
Thanks.
On 8/30/12 3:09 PM, agentzh wrote:
> Hello!
>
> On Thu, Aug 30, 2012 at 10:12 AM, David | StyleFlare
> <david at styleflare.com> wrote:
>> I am trying to figure out what I dont see request headers added to the
>> request.
>>
>> I am trying to add 'X-Server-ID: $id'
>>
>> Here is a snippet form my config.
>>
>> location /{
>> more_set_input_headers 'X-Server-ID: $id';
>> more_set_headers 'X-Server-ID: $id';
>>
>> uwsgi_pass://upstream;
>> }
>>
>>
>> I see X-Server-ID sent in the response headers, but my upstream application
>> does not seem to get the Header Variable.
>>
> The more_set_input_headers directive runs at the end of the nginx
> "rewrite" phase and I think your $id variable just didn't have a value
> (yet) at that phase.
>
> You can try inserting a constant header like this:
>
> set $id "My-ID";
> more_set_input_headers "X-Server-ID: $id";
>
> I've tested the following example with nginx 1.2.3 and ngx_headers_more 0.18:
>
> location = /t {
> set $id "123456";
> more_set_input_headers 'X-Server-ID: $id';
> uwsgi_pass 127.0.0.1:1234;
> }
>
> And then in another terminal, start "nc" to listen on the local port, 1234:
>
> $ nc -l 1234
>
> And then accessing the /t location defined above:
>
> $ curl localhost:8080/t
>
> assuming your nginx is listening on the local port 8080.
>
> And now on the terminal running "nc", you should get something like
> this (omitted those non-printable bytes):
>
> H HTTP_HOST localhostHTTP_CONNECTIONCloseHTTP_X_SERVER_ID123456
>
> We can see that the X-Server-ID request header name and its value,
> "123456", are indeed sent by ngx_uwsgi.
>
> Best regards,
> -agentzh
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
More information about the nginx
mailing list