aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorNoah Loomans <noahloomans@gmail.com>2017-03-08 11:07:42 +0100
committerNoah Loomans <noahloomans@gmail.com>2017-03-08 11:07:42 +0100
commitd4ea3ff68f5b476aab009672968d3d348782a367 (patch)
tree8f9efead7e591c0e35ae6ddc4831fa9fe233b4aa /bin
parentec2cbd4954fb42f135f47d1e3db8d69301247080 (diff)
Use 301 redirect instead of 302useHTTPS
Diffstat (limited to 'bin')
-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()
-}