Created
August 28, 2016 19:27
-
-
Save nethoncho/cefe66d7ef2ea103d3db7aed6f426728 to your computer and use it in GitHub Desktop.
This file contains 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
/* | |
* config/bootstrap.js | |
* Example of how to redirect all http request to https | |
* See http://jsbot.io/node/http-and-https-handle-with-sailsjs | |
* | |
*/ | |
module.exports.bootstrap = function(cb) { | |
var express = require("express") | |
var app = express(); | |
app.get('*', function(req,res) { | |
if(req.isSocket) | |
return res.redirect('wss://' + req.headers.host + req.url); | |
return res.redirect('https://' + req.headers.host + req.url); | |
}).listen(80); | |
cb(); | |
}; |
Your hook works nicely. Thanks
Thanks for sharing!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I've created a simple hook to achieve this.