aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoah Loomans <noahloomans@gmail.com>2017-03-08 11:09:09 +0100
committerNoah Loomans <noahloomans@gmail.com>2017-03-08 11:09:09 +0100
commit975c3f20a32b7bdd0f263c1482deb0fba7251912 (patch)
treedd92c0c2dd6e57c72d7242069f9da53b425edf7f
parente830d6722c9ac4b2a9e6e7972014949abb535ff1 (diff)
parentd4ea3ff68f5b476aab009672968d3d348782a367 (diff)
Merge branch 'useHTTPS' into beta
-rwxr-xr-xbin/www10
1 files changed, 5 insertions, 5 deletions
diff --git a/bin/www b/bin/www
index 1c08756..4c375d3 100755
--- a/bin/www
+++ b/bin/www
@@ -25,6 +25,11 @@ function setupHTTPS () {
app.set('port', httpsPort)
}
+function redirectToHTTPS (req, res) {
+ res.writeHead(301, { 'Location': 'https://' + req.headers['host'] + req.url })
+ res.end()
+}
+
function setupHTTPSRedirect () {
const httpPort = normalizePort(process.env.PORT || '3000')
const httpServer = http.createServer(redirectToHTTPS)
@@ -110,8 +115,3 @@ if (useHTTPS) {
console.warn(`NOT USING HTTPS! Could not read ${fileLocations.privkey}`)
setupHTTP()
}
-
-function redirectToHTTPS (req, res) {
- res.writeHead(302, { 'Location': 'https://' + req.headers['host'] + req.url })
- res.end()
-}