gpt4 book ai didi

node.js - 使用护照时apache重定向到本地主机

转载 作者:太空宇宙 更新时间:2023-11-04 00:51:00 25 4
gpt4 key购买 nike

我将 Node 应用程序托管到服务器。在我的应用程序中,我使用护照进行 facebook google+ 和 twitter 登录。但重定向的网址转到 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 从 localhost 更改为重定向到该 IP 的 IP 地址时。我给了 domine 地址,它不起作用。

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

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

我的网址

 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 || '/');
});

最佳答案

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

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

关于node.js - 使用护照时apache重定向到本地主机,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32441555/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com