使用Windows

时间:2015-07-02 09:08:16

标签: node.js ssl express

我已经看过this topic about the same issue,但提供的解决方案似乎无法将端口从3000更改为SSL使用的默认443。

我在某些地方看到iptables应该用它来完成它,但在Windows环境中,这不可能这样做。

暂时我通过手动删除3000端口来修复它:

//redirecting to HTTPS if the connection is not secure
app.use(function(req,resp,next){
    if (!req.secure) {
        return resp.redirect(301, 'https://' + req.headers.host.replace(':3000', '') +  req.url);
    } else {
        return next();
    }
});

任何适当的解决方案吗?

0 个答案:

没有答案