Skip to content
This repository was archived by the owner on Feb 2, 2024. It is now read-only.

Commit e10a7a1

Browse files
authored
Merge pull request #7 from jkyberneees/improve-proxy-headers-management
Improve proxy headers management
2 parents a724001 + 7662ea9 commit e10a7a1

File tree

4 files changed

+1054
-800
lines changed

4 files changed

+1054
-800
lines changed

index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,10 @@ module.exports = (opts) => {
4747
}
4848

4949
const sourceHttp2 = req.httpVersionMajor === 2
50-
const headers = sourceHttp2 ? filterPseudoHeaders(req.headers) : req.headers
51-
headers.host = url.hostname
50+
const headers = { ...sourceHttp2 ? filterPseudoHeaders(req.headers) : req.headers }
51+
headers['x-forwarded-host'] = req.headers.host
52+
headers.host = `${url.hostname}:${url.port}`
53+
5254
const qs = getQueryString(url.search, req.url, opts)
5355

5456
let body = null

0 commit comments

Comments
 (0)