Skip to content

Commit

Permalink
feat: add support for x-forward-port header
Browse files Browse the repository at this point in the history
* feat: add support for x-forward-port header

* fix: remove unnecessary port additions

* chore: remove unused dependency
  • Loading branch information
daniel-milemarker authored Dec 17, 2024
1 parent 93f72c1 commit 6346aa2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ const getUrlObject = (req) => {
// support overriding hostname by sending X-Forwarded-Host http header
urlObject.hostname = req.hostname;

// support overriding port by sending X-Forwarded-Port http header
const xForwardedPort = req.get('X-Forwarded-Port');
if (xForwardedPort) {
urlObject.port = xForwardedPort;
}

// support add url prefix by sending X-Forwarded-Path http header
const xForwardedPath = req.get('X-Forwarded-Path');
if (xForwardedPath) {
Expand Down

0 comments on commit 6346aa2

Please sign in to comment.