From 866732bdae5d60eab164cca3e2970539696ca33e Mon Sep 17 00:00:00 2001 From: benweet Date: Mon, 7 Oct 2013 02:17:55 +0100 Subject: [PATCH] Force https on stackedit.io --- server.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/server.js b/server.js index c89d8559..5935b542 100644 --- a/server.js +++ b/server.js @@ -1,7 +1,8 @@ var express = require('express'); var app = express(); + +// Force HTTPS on stackedit.io app.all('*', function(req, res, next) { - console.log(req.headers); if (req.headers.host == 'stackedit.io' && req.headers['x-forwarded-proto'] != 'https') { res.redirect('https://stackedit.io' + req.url); } @@ -9,6 +10,12 @@ app.all('*', function(req, res, next) { next(); } }); + +// Use gzip compression app.use(express.compress()); + +// Serve static resources app.use(express.static(__dirname + '/public')); + +// Listen on port 3000 app.listen(process.env.PORT || 3000); \ No newline at end of file