请求 ws可以请求成功,请求 wss不可以出现报错问题
SSLProxyEngine on
ProxyRequests Off
ProxyPass /wss ws://127.0.0.1:8888
ProxyPassReverse /wss ws://127.0.0.1:8888
WebSocket connection to 'wss://www.ccc.com/wss' failed: Error during WebSocket handshake: Unexpected response code: 404
wx.connectSocket({
url: 'wss://www.ccc.com/wss',
success:(function(){
console.log("发送请求");
})
});
//socket打开时执行的事情
wx.onSocketOpen(function(res) {
console.log("websocket 已连接!");
wx.sendSocketMessage({
data:'XC20221107123456'
});
});
wx.onSocketError(function(errMsg){
console.log("错误:".errMsg);
})
//服务器给用户发信息触发的事件
wx.onSocketMessage(function(res) {
console.log("收到服务端的消息:" + res.data);
});
wx.onSocketClose(function(res) {
console.log("websocket 已关闭!");
});
请求url url: 'ws://www.ccc.com/wss' 可以成功,就是wss请求 出现下面文字问题
WebSocket connection to 'wss://www.ccc.com/wss' failed: Error during WebSocket handshake: Unexpected response code: 404(env: Windows,mp,1.05.2110290; lib: 2.12.2)
https://www.workerman.net/doc/workerman/faq/secure-websocket-server.html#%E5%88%A9%E7%94%A8apache%E4%BB%A3%E7%90%86wss
对比下手册,看看是不是少了啥配置或者模块
我检查了一下,没有缺少,现在是 ws是可以访问的,wss请求就是不行
你这样访问:https://www.ccc.com/wss ,看看不能能成功。成功的话,页面会显示 :Websocket