Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions doc/api/url.md
Original file line number Diff line number Diff line change
Expand Up @@ -1853,7 +1853,7 @@ input. CVEs are not issued for `url.parse()` vulnerabilities. Use the
function getURL(req) {
const proto = req.headers['x-forwarded-proto'] || 'https';
const host = req.headers['x-forwarded-host'] || req.headers.host || 'example.com';
return new URL(req.url || '/', `${proto}://${host}`);
return new URL(`${proto}://${host}${req.url || '/'}`);
}
```

Expand All @@ -1863,7 +1863,7 @@ use the example below:

```js
function getURL(req) {
return new URL(req.url || '/', 'https://example.com');
return new URL(`https://example.com${req.url || '/'}`);
}
```

Expand Down
Loading