是这样的, 我这边的 nodejs 项目的 https 是在 nginx 一层做的, 也就是说 server 端没有 https 部分的东西, 仅在 nginx 一层做了 https 的处理.
问题来了, 我在 nodejs 创建的 socket.io 服务是 http 的, 页面请求的是 https 的, 报了 ERR_INSECURE_RESPONSE 错误,
这种情况该如何处理呢
=========================================================================================================
最后是这么解决的,nodejs 那边还是 http 的服务,socketio 的端口直接就是 http 的端口,
在 nginx 的配置中添加了
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
nginx 配置了全站 https 页面连接 socket, var socket = io() 即可
关键词 nginx proxy websocket,nginx websocket 传送门
完结。