nginxリバースプロキシとsslを使用して新しいサーバー設定を試していますが、Google OAuth2を破損しているようです。私はnode6を管理するためにノードv6.2.2、pm2を使用しており、sslとリバースプロキシにはnginxを使用しています。Google OAuth2 uri_mismatch nginxリバースプロキシの背後にある場合
私のnginxのサーバーブロックは次のようになります。私のラップトップ上nodejsサーバーを実行している場合
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' Googleの戦略を使用してログインすることができんだけど、リバースプロキシの背後で同じコードを実行するとすぐにredirect_uri_mismatchが得られます。 コールバックURL〜http://example.com/auth/oauthCallbackとhttps://example.com/auth/oauthCallbackをハードコードし、すべてのバリエーションをOAuthクライアントIDに追加しました。私はサーバーブロックを少し変更しようとしましたが、あまり進歩を遂げることはできませんでした。
次のステップのためのアイデアはありますか?