我将站点从已停用的OpenShift v2转移到AWS上的LightSail。我已经在LightSail上运行该应用程序,并在外部转发,其格式为localhost:3333
。我能够使用site-url.com
反向代理发送127.0.0.1作为URL,而不是外部site-url.com到oauth回调
拉起该网站但试图登录到应用程序(使用Passport Facebook)。回调URL是越来越设置为127.0.0.1
,而不是白名单(脸谱DEV)www.site-url.com
https://www.facebook.com/dialog/oauth?response_type=code&redirect_uri=http%3A%2F%2F127.0.0.1%3A3333%2Fauth%2Fwww.site-url.com%2Fauth%2Ffacebook%2Fcallback&scope=email&client_id=XXX
相关的登录代码:
const appUrl = "www.site-url.com";
const callbackURL = appUrl + "/auth/facebook/callback";
passport.use(new FacebookStrategy({
clientID: clientID,
clientSecret: clientSecret,
callbackURL: callbackURL,
profileFields: ['id', 'displayName', 'email']
},
...
app.get('/auth/facebook',
passport.authenticate('facebook', { scope: ['email'] }));
app.get('/auth/facebook/callback',
passport.authenticate('facebook',{
successRedirect: appUrl + '/profile',
failureRedirect: appUrl + '/?login-failed'}
));
我加appUrl
,试图通过服务器来解决它码。不过,我有一种感觉,Apache会更适合解决这个问题。
我设置了代理服务器,以下these instructions,并试图127.x/site-url.com
ProxyPass/http://127.0.0.1:3333/
# ProxyPass/http://www.site-url.com/
ProxyPassReverse/http://127.0.0.1:3333/
# ProxyPassReverse/http://www.site-url.com/
任何人的所有变化有什么想法?
尝试在'ProxyPass'之前添加'ProxyPreserveHost On'' –
谢谢@DusanBajic,这正是需要的:) –