Welcome! Log In Create A New Profile

Advanced

Re: header with underscore

January 27, 2011 05:18AM
On Thu, Jan 27, 2011 at 09:41:39AM +0100, Daniele Melosi wrote:

> 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 --header "Host:
> myhost" --header "X_UP_CALLING_LINE_ID: daniele" | grep daniele
>
> $ curl -s 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 :)

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 Sysoev
http://sysoev.ru/en/

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

header with underscore

Daniele Melosi January 27, 2011 03:46AM

Re: header with underscore

Igor Sysoev January 27, 2011 05:18AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 144
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready