Running on Windows Azure Websites, I want to use ssl via the default *.azurewebsites.net certificate. It works without doing anything, but http is also available for every destination, not just https. How do I force a redirect from http to https? Normally I could just do something like:
var https = require('https');
...
var options = {
key: fs.readFileSync('path.key'),
cert: fs.readFileSync('path.crt')
};
...
https.createServer(options, app)
but since I don't know anything about the *.azurewebsites.net certificate, such as its path, that's not going to work.
How do I redirect all or some requests to https?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…