Skip to content

Commit 7c7bc45

Browse files
committed
docs: remove special meaning of 'back' value in res-location.md
1 parent 1be7fbc commit 7c7bc45

2 files changed

Lines changed: 2 additions & 6 deletions

File tree

_includes/api/en/4x/res-location.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ res.location('http://example.com')
88
res.location('back')
99
```
1010

11+
{% include admonitions/note.html content="`'back'` was deprecated in 4.21.0, use `req.get('Referrer') || '/'` as an argument instead." %}
12+
1113
A `path` value of "back" has a special meaning, it refers to the URL specified in the `Referer` header of the request. If the `Referer` header was not specified, it refers to "/".
1214

1315
See also [Security best practices: Prevent open redirect

_includes/api/en/5x/res-location.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,8 @@ Sets the response `Location` HTTP header to the specified `path` parameter.
55
```js
66
res.location('/foo/bar')
77
res.location('http://example.com')
8-
res.location('back')
98
```
109

11-
A `path` value of "back" has a special meaning, it refers to the URL specified in the `Referer` header of the request. If the `Referer` header was not specified, it refers to "/".
12-
13-
See also [Security best practices: Prevent open redirect
14-
vulnerabilities](http://expressjs.com/en/advanced/best-practice-security.html#prevent-open-redirects).
15-
1610
<div class='doc-box doc-warn' markdown="1">
1711
After encoding the URL, if not encoded already, Express passes the specified URL to the browser in the `Location` header,
1812
without any validation.

0 commit comments

Comments
 (0)