use https-redirect as default app for httpServer

This commit is contained in:
AJ ONeal 2019-11-01 22:55:39 -06:00
parent 1eba51ea22
commit 37c3aee99f
1 changed files with 4 additions and 1 deletions

View File

@ -23,6 +23,9 @@ Servers.create = function(greenlock) {
return _httpServer; return _httpServer;
} }
if (!defaultApp) {
defaultApp = require("redirect-https")();
}
_httpServer = http.createServer(HttpMiddleware.create(greenlock, defaultApp)); _httpServer = http.createServer(HttpMiddleware.create(greenlock, defaultApp));
_httpServer.once("error", startError); _httpServer.once("error", startError);
@ -89,7 +92,7 @@ Servers.create = function(greenlock) {
var id = cluster.isWorker && cluster.worker.id; var id = cluster.isWorker && cluster.worker.id;
var idstr = (id && "#" + id + " ") || ""; var idstr = (id && "#" + id + " ") || "";
var plainServer = servers.httpServer(require("redirect-https")()); var plainServer = servers.httpServer();
var plainAddr = "0.0.0.0"; var plainAddr = "0.0.0.0";
var plainPort = 80; var plainPort = 80;
plainServer.listen(plainPort, plainAddr, function() { plainServer.listen(plainPort, plainAddr, function() {