better log output, comment typo, var declaration in better place

This commit is contained in:
AJ ONeal 2015-02-20 22:34:17 +00:00
parent 90640ee8e7
commit 2f53e7fadb
1 changed files with 5 additions and 4 deletions

View File

@ -2,7 +2,6 @@
var http = require('http'); var http = require('http');
var escapeRe = require('escape-string-regexp'); var escapeRe = require('escape-string-regexp');
var insecureServer;
module.exports.create = function (securePort, insecurePort, redirects) { module.exports.create = function (securePort, insecurePort, redirects) {
function redirectHttps(req, res) { function redirectHttps(req, res) {
@ -76,13 +75,15 @@ module.exports.create = function (securePort, insecurePort, redirects) {
// and then hands control over completely to respawned server // and then hands control over completely to respawned server
// //
// Redirect HTTP ot HTTPS // Redirect HTTP to HTTPS
// //
// This simply redirects from the current insecure location to the encrypted location // This simply redirects from the current insecure location to the encrypted location
// //
var insecureServer;
insecureServer = http.createServer(); insecureServer = http.createServer();
insecureServer.on('request', redirectHttps); insecureServer.on('request', redirectHttps);
insecureServer.listen(insecurePort, function () { insecureServer.listen(insecurePort, function () {
console.log("\nRedirecting all http traffic to https\n"); console.log("\nListening on https://localhost:" + insecureServer.address().port);
console.log("(redirecting all traffic to https)\n");
}); });
}; };