We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 987a023 commit 9446832Copy full SHA for 9446832
doc/api/url.md
@@ -1847,7 +1847,7 @@ input. CVEs are not issued for `url.parse()` vulnerabilities. Use the
1847
function getURL(req) {
1848
const proto = req.headers['x-forwarded-proto'] || 'https';
1849
const host = req.headers['x-forwarded-host'] || req.headers.host || 'example.com';
1850
- return new URL(req.url || '/', `${proto}://${host}`);
+ return new URL(`${proto}://${host}${req.url || '/'}`);
1851
}
1852
```
1853
@@ -1857,7 +1857,7 @@ use the example below:
1857
1858
```js
1859
1860
- return new URL(req.url || '/', 'https://example.com');
+ return new URL(`https://example.com${req.url || '/'}`);
1861
1862
1863
0 commit comments