From ed47fb80b53df01b7969f8f28569197a72e83f2c Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Thu, 27 Oct 2016 02:44:14 -0600 Subject: [PATCH] specifying insecurePort --- bin/serve-https.js | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/bin/serve-https.js b/bin/serve-https.js index e2af24b..21ae6b1 100755 --- a/bin/serve-https.js +++ b/bin/serve-https.js @@ -177,15 +177,23 @@ function createServer(port, pubdir, content, opts) { server2.watch(pubdir); } - if ('false' !== opts.insecurePort && httpPort === opts.insecurePort) { - return createInsecureServer(opts.insecurePort, pubdir, opts).then(function (_server) { - insecureServer = _server; - resolve(); - }); - } else { - opts.insecurePort = opts.port; - resolve(); + // if we haven't disabled insecure port + if ('false' === opts.insecurePort) { + // and both ports are the default + if ((httpsPort === opts.port && httpPort === opts.insecurePort) + // or other case + || (httpPort !== opts.insecurePort && opts.port !== opts.insecurePort) + ) { + return createInsecureServer(opts.insecurePort, pubdir, opts).then(function (_server) { + insecureServer = _server; + resolve(); + }); + } } + + opts.insecurePort = opts.port; + resolve(); + return; }); if ('function' === typeof app) {