【发布时间】:2016-03-15 22:19:57
【问题描述】:
我有这个 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
但在服务器中,我在标头中没有令牌。
为什么????
【问题讨论】:
标签: ruby-on-rails nginx reverse-proxy