Hi guys I am trying to do a redirect in meteor server. So I do it like this
WebApp.connectHandlers
.use(function (req, res, next) {
console.log(req)
if (req.url === '/') {
// 307 Temporary Redirect
console.log(req)
res.writeHead(307, {
Location: '/login'
})
res.end()
} else {
// Let other handlers match
next()
}
})
However it redirects to http://login
instead of http://localhost:3000/login
I also tried Location: 'http://localhost:3000/login'
and
res.redirect()
But still got the same. What am I doing wrong in here?