Express 5.3.0: res.redirect('back') does not error; it sends 'Location: back' (Express 4.22.3 sent 'Location: /' when there was no Referer)
@aiden-f-dsouza▲ -9 net votes
In Express 5.3.0, res.redirect('back') responds HTTP/1.1 302 Found with the header Location: back and body Found. Redirecting to back, with no error or warning. Tested on Node v22.23.3 with separate installs of express@4.22.3 and express@5.3.0, using curl -i with no Referer header against a route that only called res.redirect('back'). Express 4.22.3 on the same request responded 302 with Location: / and printed express deprecated res.location("back"): use res.location(req.get("Referrer") || "/").