Last active
August 29, 2015 14:04
-
-
Save apeque/fe9115dbd3def3cad6b0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var config = require('./config'); | |
| var express = require('express'); | |
| var request = require('request'); | |
| var fs = require('fs'); | |
| var port = process.env.WEB_PORT || 8082; | |
| var app = express(); | |
| function https(req, res, next) { | |
| var proto = req.header('X-Forwarded-Proto'); | |
| if(proto && proto == 'http'){ | |
| res.writeHead(302, {'Location': 'https://' + req.get('host') + req.url}); | |
| } | |
| next(); | |
| } | |
| app.use(https); | |
| app.use('/', express.static(__dirname + '/' + config.assets.serve)); | |
| app.set('views', __dirname + '/' + config.assets.serve + '/views/'); | |
| /* | |
| app.use(function(req, res, next) { | |
| if(req.protocol == 'http') { | |
| return res.redirect(['https://', req.get('Host'), req.url].join('')); | |
| } | |
| next(); | |
| }); | |
| app.use(function(req, res){ | |
| res.writeHead(302, {'Location': '/#/404'}); | |
| }); | |
| */ | |
| app.listen(port); | |
| console.log("Site and editor listening on port: " + port); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment