Skip to content

Commit

Permalink
changed server.js
Browse files Browse the repository at this point in the history
  • Loading branch information
nikbabchenko committed Jan 7, 2018
1 parent d0abbb5 commit 1acd996
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@ app.use(cors());
// a protocol other than HTTPS,
// redirect that request to the
// same url but with HTTPS
const forceSSL = function () {
return function (req, res, next) {
if (req.headers['x-forwarded-proto'] !== 'http') {
return res.redirect(
['http://', req.get('Host'), req.url].join('')
);
}
next();
}
}
// const forceSSL = function () {
// return function (req, res, next) {
// if (req.headers['x-forwarded-proto'] !== 'https') {
// return res.redirect(
// ['https://', req.get('Host'), req.url].join('')
// );
// }
// next();
// }
// }
// // Instruct the app
// // to use the forceSSL
// // middleware
app.use(forceSSL());
// app.use(forceSSL());
// Run the app by serving the static files
// in the dist directory
app.use(express.static(__dirname + '/dist'));
Expand Down

0 comments on commit 1acd996

Please sign in to comment.