# Accessing custom upstream proxy header

**URL:** <https://www.ruby-forum.com/t/accessing-custom-upstream-proxy-header/225146>\
**Category:** NGINX\
**Created:** [December 17, 2012, 9:06pm UTC](https://www.ruby-forum.com/t/accessing-custom-upstream-proxy-header/225146 "2012-12-17T21:06:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![aris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aris](https://www.ruby-forum.com/u/aris)\
**Post date:** [December 17, 2012, 9:06pm UTC](https://www.ruby-forum.com/t/accessing-custom-upstream-proxy-header/225146/1 "2012-12-17T21:06:43Z")

</div>

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:

> **[Accessing custom upstream proxy header](https://forum.nginx.org/read.php?2,234126,234126#msg-234126)**
>
> 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

---

<div class="post-metadata">

**Author:** ![preinde](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/779978/32.png) [@preinde](https://www.ruby-forum.com/u/preinde)\
**Post date:** [December 18, 2012, 1:01pm UTC](https://www.ruby-forum.com/t/accessing-custom-upstream-proxy-header/225146/2 "2012-12-18T13:01:47Z")

</div>

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 D.

> **[F5 NGINX: Built for cloud-native apps. Ready for AI traffic.](https://www.f5.com/products/nginx)**
>
> Deliver modern applications with NGINX. Explore high-performance load balancing, API gateways, and web server solutions trusted by top global enterprises.
