Skip to content

Commit 1ddaab1

Browse files
styfleaduh95
authored andcommitted
doc: mention reverse proxy and include simple example
PR-URL: #59736 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Gerhard Stöbich <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
1 parent 3b3b71e commit 1ddaab1

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

doc/api/url.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1716,6 +1716,16 @@ and incorrect handling of usernames and passwords. Do not use with untrusted
17161716
input. CVEs are not issued for `url.parse()` vulnerabilities. Use the
17171717
[WHATWG URL][] API instead.
17181718

1719+
The example above assumes well-formed headers are forwarded from a reverse
1720+
proxy to your Node.js server. If you are not using a reverse proxy, you should
1721+
use the example below:
1722+
1723+
```js
1724+
function getURL(req) {
1725+
return new URL(req.url || '/', 'https://example.com');
1726+
}
1727+
```
1728+
17191729
### `url.resolve(from, to)`
17201730

17211731
<!-- YAML

0 commit comments

Comments
 (0)