返回列表

express 设置302 redirect req.protocol +'://' + req.headers.host + ':8082' + (req.originalUrl||'')

默认分类 2018/07/24 03:05

express设置302 redirect

app.get('/main.html', function (req, res) {
  res.redirect(req.protocol +'://' + req.headers.host + ':8082' + (req.originalUrl||''))
})

注:#后面的默认不会带到服务端,因此#带的参数需要自己处理

app.get('/main.html', function (req, res) {
  res.redirect(req.protocol +'://' + req.headers.host + ':8082' + '/main.html#!/schedule?project_id=1000001&group_id=1000012')
})