Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 66d90b8

Browse filesBrowse files
styfletargos
authored andcommitted
doc: mention reverse proxy and include simple example
PR-URL: #59736 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
1 parent 14aa111 commit 66d90b8
Copy full SHA for 66d90b8

File tree

Expand file treeCollapse file tree

1 file changed

+10
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+10
-0
lines changed
Open diff view settings
Collapse file

‎doc/api/url.md‎

Copy file name to clipboardExpand all lines: doc/api/url.md
+10Lines changed: 10 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -1851,6 +1851,16 @@ function getURL(req) {
18511851
}
18521852
```
18531853
1854+
The example above assumes well-formed headers are forwarded from a reverse
1855+
proxy to your Node.js server. If you are not using a reverse proxy, you should
1856+
use the example below:
1857+
1858+
```js
1859+
function getURL(req) {
1860+
return new URL(req.url || '/', 'https://example.com');
1861+
}
1862+
```
1863+
18541864
### `url.resolve(from, to)`
18551865
18561866
<!-- YAML

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.