Closed lulersoft closed 6 years ago
从错误来看你这个还没有走到 websockify_pass ssl 握手就失败了啊
建议先把 https 关了 验证下 websockify_pass
这是浏览器的头部信息:
Request URL:wss://我服务器的地址/chat Request Method:GET Status Code:101 Switching Protocols Connection:upgrade Date:Wed, 28 Mar 2018 11:04:12 GMT Sec-WebSocket-Accept:Pa27LTdRa4KkmixYLRExU9aNrtA= Sec-WebSocket-Protocol:binary Server:nginx Upgrade:websocket Accept-Encoding:gzip, deflate, br Accept-Language:zh-CN,zh;q=0.9 Cache-Control:no-cache Connection:Upgrade Host:我服务器的地址 Origin:https://我服务器的地址 Pragma:no-cache Sec-WebSocket-Extensions:permessage-deflate; client_max_window_bits Sec-WebSocket-Key:q/bl2zcPugUxvGSMA42y7w== Sec-WebSocket-Protocol:binary Sec-WebSocket-Version:13 Upgrade:websocket User-Agent:Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.119 Safari/537.36
看起来是已经握手成功了,问题是其它的吧?
127.0.0.1:64738 是 ssl 协议吗 websockify_pass 目前不支持 upstream 是 ssl 协议的情况
独立执行websockify: websockify 64737 127.0.0.1:64738 --ssl-target -v --traffic --cert ./self.pem --key .self.pem
执行提示: WebSocket server settings:
你做的模块和独立的websockify有任何关系吗?
啥时候更新一下你的模块:),不然另外开个websockify 不太方便。
目前并没有计划支持 upstream 使用 ssl 协议
单独使用websockify进行转发代理是成功的,使用nginx内置websockify模块,提示协议错误。
127.0.0.1:64738 是聊天服务器
单独使用的代码: websockify 64737 127.0.0.1:64738 --ssl-target -v --traffic --cert ./self.pem --key .self.pem
nginx配置: server { listen 443 ssl; server_name voice.example.com; ssl_certificate /etc/letsencrypt/live/voice.example.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/voice.example.com/privkey.pem;
}
map $http_upgrade $connection_upgrade { default upgrade; '' close; }
以上是独立使用websockify是运行成功的。
下面是根据本模块的用的配置:
server { listen 443 ssl; server_name voice.example.com; ssl_certificate /etc/letsencrypt/live/voice.example.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/voice.example.com/privkey.pem;
}
使用内置服务器提示错误: