diff options
author | Noah Loomans <noahloomans@gmail.com> | 2017-03-08 11:07:42 +0100 |
---|---|---|
committer | Noah Loomans <noahloomans@gmail.com> | 2017-03-08 11:07:42 +0100 |
commit | d4ea3ff68f5b476aab009672968d3d348782a367 (patch) | |
tree | 8f9efead7e591c0e35ae6ddc4831fa9fe233b4aa | |
parent | ec2cbd4954fb42f135f47d1e3db8d69301247080 (diff) |
Use 301 redirect instead of 302useHTTPS
-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() -} |