标签: node.js express connect
有没有办法在Express中获得协议(http | https)?
答案 0 :(得分:5)
req.protocol:
req.protocol
app.get('/protocol', function (req, res) { res.send(req.protocol); });
但是,您可能还需要enable trust proxy来申请:
enable
trust proxy
app.configure('production', function () { app.enable('trust proxy'); });