繁体   English   中英

使用护照时将apache重定向到本地主机

[英]apache redirect to localhost when using passport

我将节点应用程序托管到服务器。 在我的应用程序中,我使用了用于Facebook google +和twitter登录的通行证。但是重定向的URL进入了localhost:3000。

<VirtualHost *:80>
ServerAdmin exaple@gmail.com
ServerName example.com
ServerAlias www.example.com
ProxyRequests off
<Proxy *>
    Order deny,allow
    Allow from all
</Proxy>
<Location />
    ProxyPass http://localhost:3000/
    ProxyPassReverse http://localhost:3000/
</Location>

当我将ProxyPass从本地主机更改为重定向到该IP的IP地址时。 我给了主地址,它不起作用。

请帮我。 我只想重定向到我的域名(example.com)。

我在facebook twitter和google中创建了应用程序,并在我的域名中注册了。

我的网址

 app.get('/:cc/userSignInGoogle', passport.authenticate('google', { scope: 'https://www.googleapis.com/auth/plus.me https://www.google.com/m8/feeds https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile' }));
app.get('/userSignInGoogle/callback', passport.authenticate('google', { failureRedirect: '/' }), function(req, res) {
res.redirect(req.session.returnTo || '/');
});

您想在使用护照成功通过身份验证后进行重定向吗? 然后,您应该在代码中而不是在apache配置中更改successRedirect。

app.post('/login', passport.authenticate('local',
 { successRedirect: '/',
   failureRedirect: '/login' 
 }));

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM