From 6fbc37ae36148b517d66c236b9e6afa856fea009 Mon Sep 17 00:00:00 2001 From: daniel-milemarker <98341433+daniel-milemarker@users.noreply.github.com> Date: Mon, 16 Dec 2024 17:56:57 -0700 Subject: [PATCH] feat: add support for x-forward-port header * feat: add support for x-forward-port header * fix: remove unnecessary port additions * chore: remove unused dependency --- src/utils.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/utils.js b/src/utils.js index 4f976f512..85dad1a1a 100644 --- a/src/utils.js +++ b/src/utils.js @@ -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) {