From 34096b73ef26eaa60b49ff6062095b0900bec13e Mon Sep 17 00:00:00 2001 From: ahwayakchih Date: Tue, 16 Feb 2021 20:37:52 +0100 Subject: [PATCH] fix: do not overwrite `config.port` from URL, if it's already set If URL was set to something like `http://example.com:8080`, and port was set to 4567, keep listening on port 4567 and keep linking through URL that was specified. This allows to listen on port 4567, while having NGINX (or any proxy) set to listen on port 8080 and route traffic to port 4567. So NodeBB can be "hidden" behind proxy while URL can still contain non-standard port, i.e., port different than 80 and 443. --- src/install.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/install.js b/src/install.js index 36843d1881..4b22bc4037 100644 --- a/src/install.js +++ b/src/install.js @@ -175,7 +175,7 @@ async function completeConfigSetup(config) { config.url = `http://${config.url}`; } const urlObj = url.parse(config.url); - if (urlObj.port) { + if (urlObj.port && (!install.values || !install.values.hasOwnProperty('port'))) { config.port = urlObj.port; }