diff options
Diffstat (limited to 'bin')
-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() -} |