Forum: NGINX Accessing custom upstream proxy header

Posted by preinde (Guest)
on 2012-12-17 21:06
(Received via mailing list)
Good morning,

Using ngx_http_request_t, how can I access a custom upstream header 
within a
module, for example:

r->upstream->headers_in->xxx_my_header->value

No matter what I try, it doesn't appear to be working

- Peter

Posted at Nginx Forum: 
http://forum.nginx.org/read.php?2,234126,234126#msg-234126
Posted by Maxim Dounin (Guest)
on 2012-12-18 13:01
(Received via mailing list)
Hello!

On Mon, Dec 17, 2012 at 03:05:51PM -0500, preinde wrote:

> Good morning,
>
> Using ngx_http_request_t, how can I access a custom upstream header within a
> module, for example:
>
> r->upstream->headers_in->xxx_my_header->value
>
> No matter what I try, it doesn't appear to be working

Obviously enough the r->upstream->headers_in structure won't
contain any specific members for your custom header unless you
patch nginx.

If you want to search for a custom header within a module, you
have to iterate though &r->upstream->headers_in.headers list.  See
e.g.  ngx_http_upstream_header_variable() and
ngx_http_variable_unknown_header(), used to implement
$upstream_http_* variables.

--
Maxim Dounin
http://nginx.com/support.html
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.