mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-18 03:31:03 +01:00
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.
This commit is contained in:
@@ -175,7 +175,7 @@ async function completeConfigSetup(config) {
|
|||||||
config.url = `http://${config.url}`;
|
config.url = `http://${config.url}`;
|
||||||
}
|
}
|
||||||
const urlObj = url.parse(config.url);
|
const urlObj = url.parse(config.url);
|
||||||
if (urlObj.port) {
|
if (urlObj.port && (!install.values || !install.values.hasOwnProperty('port'))) {
|
||||||
config.port = urlObj.port;
|
config.port = urlObj.port;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user