在 Nginx 中自定义 Headers

Custom Headers in Nginx

我有这个nginx.conf

server {

listen  <%= ENV['NGINX_IP'] %>:<%= ENV['NGINX_PORT'] %>;
server_name proxy-oapp.rhcloud.com;

  location / {
    proxy_set_header X-Real-IP $remote_addr;
    #proxy_set_header Host $http_host;
    proxy_set_header X-forwarded-for $proxy_add_x_forwarded_for;
    proxy_set_header X-NginX-Proxy true;
    proxy_pass https://app-oapp.rhcloud.com;
    proxy_redirect off;
  }
  location /api {
    proxy_set_header Host api-oapp.rhcloud.com;
    proxy_set_header X-forwarded-for $proxy_add_x_forwarded_for;
    proxy_set_header X-NginX-Proxy true;
    proxy_set_header X_Auth_Token $upstream_http_x_auth_token;
    proxy_set_header X_User_Id $upstream_http_x_user_id;
    proxy_pass https://api-oapp.rhcloud.com/; 
    proxy_redirect off;
  }
}

客户端在headers中添加用于身份验证的id和令牌为: X_Auth_Token:我的代币 X_User_Id: 我的ID

但是在服务器中我没有 headers 中的令牌。

为什么????

错误在下划线。 我必须改变这个

X_Auth_Token: MYTOKEN 
X_User_Id: MYID

这是:

X-Auth-Token: MYTOKEN 
X-User-Id: MYID