mirror of
https://github.com/hanzoai/express.git
synced 2026-09-24 16:59:04 +00:00
Deprecate "back" magic string in redirects (#5935)
This commit is contained in:
@@ -1,3 +1,8 @@
|
||||
unreleased
|
||||
==========
|
||||
|
||||
* Deprecate `res.location("back")` and `res.redirect("back")` magic string
|
||||
|
||||
4.20.0 / 2024-09-10
|
||||
==========
|
||||
* deps: serve-static@0.16.0
|
||||
|
||||
@@ -916,6 +916,7 @@ res.location = function location(url) {
|
||||
|
||||
// "back" is an alias for the referrer
|
||||
if (url === 'back') {
|
||||
deprecate('res.location("back"): use res.location(req.get("Referrer") || "/") and refer to https://dub.sh/security-redirect for best practices');
|
||||
loc = this.req.get('Referrer') || '/';
|
||||
} else {
|
||||
loc = String(url);
|
||||
|
||||
Reference in New Issue
Block a user