From 5bf92029c5044b32d1ecedca615530073b4b6b1a Mon Sep 17 00:00:00 2001 From: clarkbains Date: Wed, 23 Dec 2020 13:58:35 -0500 Subject: [PATCH 1/3] Fixed Redirection Issue --- lib/proxy.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/proxy.js b/lib/proxy.js index 1d876c0..0621ad9 100755 --- a/lib/proxy.js +++ b/lib/proxy.js @@ -761,7 +761,11 @@ function redirectToHttps(req, res, target, ssl, log) { var targetPort = ssl.redirectPort || ssl.port; var hostname = req.headers.host.split(':')[0] + (targetPort ? ':' + targetPort : ''); - var url = 'https://' + path.posix.join(hostname, req.url); + var redirectPath = req.url + if (req.url.indexOf(target.path)===0){ + redirectPath = redirectPath.replace(target.path, "") + } + var url = 'https://' + path.posix.join(hostname, redirectPath); log && log.info('Redirecting %s to %s', path.posix.join(req.headers.host, req.url), url); // // We can use 301 for permanent redirect, but its bad for debugging, we may have it as From 0a6ab90b5ebfe7e5dbefe6802fa291e6fe7cd454 Mon Sep 17 00:00:00 2001 From: Clark Bains Date: Sat, 16 Jan 2021 00:15:43 -0500 Subject: [PATCH 2/3] Fixed crash on le registration Signed-off-by: Clark Bains --- lib/proxy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/proxy.js b/lib/proxy.js index 0621ad9..925f591 100755 --- a/lib/proxy.js +++ b/lib/proxy.js @@ -681,7 +681,7 @@ ReverseProxy.prototype._getTarget = function (src, req, res) { req.host = target.host; } - if (route.opts.onRequest) { + if (route.opts && route.opts.onRequest) { const resultFromRequestHandler = route.opts.onRequest(req, res, target); if (resultFromRequestHandler !== undefined) { this.log && From efb47db8394bec64aa8d1123069cc5a902ea8e08 Mon Sep 17 00:00:00 2001 From: Clark Bains Date: Tue, 23 Nov 2021 10:56:33 -0500 Subject: [PATCH 3/3] Hack to make ssl abckend work Signed-off-by: Clark Bains --- lib/proxy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/proxy.js b/lib/proxy.js index 925f591..168435e 100755 --- a/lib/proxy.js +++ b/lib/proxy.js @@ -292,7 +292,7 @@ ReverseProxy.prototype.setupHttpsProxy = function (proxy, websocketsUpgrade, log var httpsServer = (this.httpsServer = https.createServer(ssl, function (req, res) { var src = _this._getSource(req); - var httpProxyOpts = Object.assign({}, _this.opts.httpProxy); + var httpProxyOpts = Object.assign({secure:false}, _this.opts.httpProxy); _this._getTarget(src, req, res).then(function (target) { if (target) {