Force https on stackedit.io

This commit is contained in:
benweet 2013-10-07 02:11:56 +01:00
parent 0783a86af4
commit f1f21df46d

View File

@ -1,5 +1,14 @@
var express = require('express'); var express = require('express');
var app = express(); var app = express();
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);
}
else {
next();
}
});
app.use(express.compress()); app.use(express.compress());
app.use(express.static(__dirname + '/public')); app.use(express.static(__dirname + '/public'));
app.listen(process.env.PORT || 3000); app.listen(process.env.PORT || 3000);