【发布时间】:2012-05-08 02:23:48
【问题描述】:
我正在使用 nodejs 和 expressjs。我想知道 clientRequest 对象中是否有类似request.headers.protocol 的东西。我想为 Web 链接构建 baseUrl。因此,如果请求是通过 https 完成的,我想在所有链接中保留 https。
var baseUrl = request.headers.protocol + request.headers.host;
【问题讨论】: