0
我在嘗試使用nginx反向代理和ssl的新服務器配置,但似乎打破了我的Google OAuth2。我正在使用節點v6.2.2,pm2來管理nodejs,並使用nginx作爲ssl和反向代理。Google OAuth2 uri_mismatch在nginx反向代理後面
我的Nginx服務器塊的樣子:
server {
listen 80;
server_name _;
return 301 https://$host$request_uri;
}
和
server {
listen 443;
ssl on;
include snippets/ssl-example.com.conf;
include snippets/ssl-params.conf;
server_name example.com;
location/{
proxy_pass http://localhost:3001;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
當運行在我的筆記本電腦我可以在使用passportjs'谷歌的策略沒有問題,登陸服務器的NodeJS,但只要我在反向代理後面運行相同的代碼,我會得到一個redirect_uri_mismatch。我試過硬編碼回調URL至http://example.com/auth/oauthCallback和https://example.com/auth/oauthCallback,並已將這些變體的所有變體添加到OAuth客戶端ID。我試過對我的服務器模塊進行小小的改動,並且無法取得進展,所以我就是這樣。
下一步的任何想法?