Header with underscore

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 :slight_smile:

Do you have any hits ?

Regards

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 :slight_smile:

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs