JHipster社交登录中的redirect_url不正确

时间:2018-04-26 20:25:18

标签: nginx oauth oauth-2.0 jhipster

Google社交登录适用于localhost,例如localhost:8888/portal

仍然在主机为domain.com/portal的生产系统上,

redirect_url 不正确domain:8888/portal

domain.com/portal

生产应用程序支持docker中的nginx代理:

location /portal {
   proxy_pass http://domain:8888;
}

https://accounts.google.com/o/oauth2/auth?clie...

的重新排序不正确
client_id=...
response_type=code
_csrf=
redirect_uri=http://domain:8888/portal/signin/google
scope=...
state= 

1 个答案:

答案 0 :(得分:0)

问题出在nginx反向代理配置中:

之前(有问题)

  location /portal {
        proxy_pass http://site:8888;

        proxy_set_header HOST $host;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }

之后(修复问题)

location /portal {
        proxy_pass http://site:8888;

        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-For $scheme;
    }