爬一堆nginx http自動轉https的文,在本機端沒問題:一照作到 aws上,就一直error
環境是aws balancer 直接Listeners 443 listen 到80
http://www.emind.co/how-to/how-to-force-https-behind-aws-elb
環境是aws balancer 直接Listeners 443 listen 到80
http://www.emind.co/how-to/how-to-force-https-behind-aws-elb
有誰有正確試出來 aws balancer http自動轉https的正確解法嗎?
目前在nodejs上的解法:
app.js:
app.use (function (req, res, next) {
var schema = (req.headers['x-forwarded-proto'] || '').toLowerCase();
if (schema === 'https') {
next();
} else {
res.redirect('https://' + req.headers.host + req.url);
}
});
但有點遜...
沒有留言:
張貼留言