Skip to content

Commit 7fbdae8

Browse files
committed
Prefer an explicitly given protocol.
The baseURL might be configured with HTTPS, but the actual HTTPS layer might be provided by a proxy. Therefore, the server should be able to launch as HTTP by explicitly setting the protocol.
1 parent 68349bd commit 7fbdae8

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Diff for: bin/ldf-server

+7-2
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,15 @@ var configDefaults = JSON.parse(fs.readFileSync(path.join(__dirname, '../config/
2020
config = _.defaults(JSON.parse(fs.readFileSync(args[0])), configDefaults),
2121
port = parseInt(args[1], 10) || config.port,
2222
workers = parseInt(args[2], 10) || config.workers,
23-
protocolMatch = (config.baseURL || '').match(/^(\w+):/),
24-
protocol = config.protocol = protocolMatch ? protocolMatch[1] : 'http',
23+
protocol = config.protocol,
2524
constructors = {};
2625

26+
// Determine protocol
27+
if (!protocol) {
28+
var protocolMatch = (config.baseURL || '').match(/^(\w+):/);
29+
protocol = config.protocol = protocolMatch ? protocolMatch[1] : 'http';
30+
}
31+
2732
// Start up a cluster master
2833
if (cluster.isMaster) {
2934
// Create workers

0 commit comments

Comments
 (0)