# Header with underscore

**URL:** <https://www.ruby-forum.com/t/header-with-underscore/202352>\
**Category:** NGINX\
**Created:** [January 27, 2011, 9:43am UTC](https://www.ruby-forum.com/t/header-with-underscore/202352 "2011-01-27T09:43:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [January 27, 2011, 9:43am UTC](https://www.ruby-forum.com/t/header-with-underscore/202352/1 "2011-01-27T09:43:19Z")

</div>

Hi all,

when proxy from nginx, if the headers contains underscore it won’t be  
passed:  
$ curl -s [http://proxy01.ced:8888/check\_headers.php](http://proxy01.ced:8888/check_headers.php) --header “Host:  
myhost” --header “X\_UP\_CALLING\_LINE\_ID: daniele” | grep daniele

$ curl -s [http://proxy01.ced:8888/check\_headers.php](http://proxy01.ced:8888/check_headers.php) --header “Host:  
myhost” --header “X-UP-CALLING-LINE-ID: daniele” | grep daniele  
[HTTP\_X\_UP\_CALLING\_LINE\_ID] =\> daniele

This is my configuration:  
server {  
listen 8888;  
server\_name proxy01.ced;

```
            keepalive_timeout 0;
            ssi off;

            underscores_in_headers on;

            location ~ / {
                    proxy_pass http://test01.ced$request_uri;
                    proxy_set_header X-Real-IP $remote_addr;
                    proxy_set_header Host $host;
                    proxy_set_header X-Org-host $host;
                    proxy_set_header X-Org-uri $request_uri;
                    proxy_set_header X-Forwarded-For

```

$proxy\_add\_x\_forwarded\_for;  
proxy\_pass\_header Server;  
proxy\_set\_header X-UP-CALLING-LINE-ID  
$HTTP\_X\_UP\_CALLING\_LINE\_ID;  
}  
}

I tried to play with:

- underscores\_in\_headers on|off
- proxy\_set\_header X-UP-CALLING-LINE-ID $HTTP\_X\_UP\_CALLING\_LINE\_ID
- proxy\_pass\_header X-UP-CALLING-LINE-ID (also with underscore)

lines but without any fortune 🙂

Do you have any hits ?

Regards

---

<div class="post-metadata">

**Author:** ![danmezzetti](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/bb73d2/32.png) [@danmezzetti](https://www.ruby-forum.com/u/danmezzetti)\
**Post date:** [January 27, 2011, 11:16am UTC](https://www.ruby-forum.com/t/header-with-underscore/202352/2 "2011-01-27T11:16:42Z")

</div>

On Thu, Jan 27, 2011 at 09:41:39AM +0100, Daniele M. wrote:

> $HTTP\_X\_UP\_CALLING\_LINE\_ID;  
> }  
> }
> 
> I tried to play with:
> 
> - underscores\_in\_headers on|off
> - proxy\_set\_header X-UP-CALLING-LINE-ID $HTTP\_X\_UP\_CALLING\_LINE\_ID
> - proxy\_pass\_header X-UP-CALLING-LINE-ID (also with underscore)
> 
> lines but without any fortune 🙂

You should set  
underscores\_in\_headers on;

and remove  
proxy\_pass\_header X-UP-CALLING-LINE-ID  
proxy\_set\_header X-UP-CALLING-LINE-ID …

nginx should pass “X\_UP\_CALLING\_LINE\_ID: daniele” to backend as is.

–  
Igor S.

> **[Igor Sysoev](http://sysoev.ru/en/)**
