【发布时间】:2014-09-26 05:13:09
【问题描述】:
我有一个 node.js 应用程序在 nginx 反向代理后面的服务器上运行。 Nginx 设置为处理 HTTP 和 HTTPS 并将两者转发到同一个 node.js 应用程序。 node.js 应用程序是否可以确定请求来自 http 还是 https?
另外,客户端的JS是否可以判断它是在http还是https?
编辑:为客户端找到了一种解决方案:
if (window.location.protocol != "https:")
还有比这更好的方法吗?
【问题讨论】:
标签: javascript node.js http nginx https