0
我已將我的node.js應用程序移動到https。我通過nginx反向代理設置了https。我有一個問題,但是當我輸入example.com時,它不會重定向到https://example.com。所以我嘗試寫我的app.js將http重定向到https,除了在本地主機上
app.get('*', function(req, res, next) {
if (req.headers.host.indexOf('localhost') > -1 || req.secure) {
return next();
}else{
res.redirect('https://'+req.hostname+req.url);
}
});
它不工作時,我重新部署,任何線索?
錯誤日誌?他們傾向於幫助... – Flummox