我有这个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;
}
}
客户端在标头中添加id和用于身份验证的令牌: X_Auth_Token:MYTOKEN X_User_Id:MYID
但是在服务器中我没有标题中的标记。
WHY ????
答案 0 :(得分:0)
错误在下划线中。 我必须改变这个
X_Auth_Token: MYTOKEN
X_User_Id: MYID
白衣:
X-Auth-Token: MYTOKEN
X-User-Id: MYID