I Realize there's a lot of topics like this,I've tried most of the solutions given there, but none of them seem to work.
I have a router that handles urls like "/pages"
module.exports = (app, mw) ->
app.get '/pages/allow-ie7', routes.allow_ie7
app.get '/pages/outdated-browser', routes.outdated_browser
app.param ':page', (req, res, next, id) ->
console.log ':page'
Page.find id, (err, page) ->
return next(err) if err?
req.resource = page
next()
routes.allow_ie7 looks like this:
exports.allow_ie7 = (req, res, next) ->
console.log 'allow ie7 test'
console.log req.session.canUseIE7
req.session.canUseIE7 = true
res.redirect 301, '/'
return true
But while I can see the logging, it won't redirect me back to the homepage.
I'm not sure why this isn't working, am I forgetting to cancel the next()?
use res.end(); after redirect:
Don't need the response code. Just pass the path '/' on 1st argument.
res.redirect('/')
res.redirect '/'