diff options
author | Noah Loomans <noahloomans@gmail.com> | 2017-03-08 11:09:09 +0100 |
---|---|---|
committer | Noah Loomans <noahloomans@gmail.com> | 2017-03-08 11:09:09 +0100 |
commit | 975c3f20a32b7bdd0f263c1482deb0fba7251912 (patch) | |
tree | dd92c0c2dd6e57c72d7242069f9da53b425edf7f | |
parent | e830d6722c9ac4b2a9e6e7972014949abb535ff1 (diff) | |
parent | d4ea3ff68f5b476aab009672968d3d348782a367 (diff) |
Merge branch 'useHTTPS' into beta
-rwxr-xr-x | bin/www | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -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() -} |