首页 > Web开发 > 详细

[Note] 解决使用Workerman和apache创建wss服务时出现的 Error during WebSocket handshake: net::ERR_RESPONSE_HEADERS_TRUNCATED

时间:2019-10-10 18:49:05      阅读:209      评论:0      收藏:0      [点我收藏+]

使用apache代理生成的wss服务常出现 Error during WebSocket handshake: net::ERR_RESPONSE_HEADERS_TRUNCATED 的问题,但多刷新几次页面就能连接成功

在官方文档没找到办法,最后在https://github.com/ratchetphp/Ratchet/issues/645找到了解决方案

这个不是Workerman的仓库,但解决办法是通用的

I could say that when some client disconnects without default websockt close protocol, ratchet keeps the connection "open", but when a new user connects then ratchet reuses somehow the last "open"(closed) connection...
Because the new client uses a old "active" connection, when it sends the HTTP handshake, ratchet complains because it isn‘t the default message frame.

是连接的重用导致了这个问题

修改apache的配置文件 conf.d/ssl.conf

在反向代理中增加一个配置 disablereuse=On,问题解决了

ProxyPass /wss ws://127.0.0.1:8282/wss disablereuse=On
ProxyPassReverse /wss ws://127.0.0.1:8282/wss

参考连接

  1. https://github.com/ratchetphp/Ratchet/issues/645
  2. http://doc.workerman.net/faq/secure-websocket-server.html

[Note] 解决使用Workerman和apache创建wss服务时出现的 Error during WebSocket handshake: net::ERR_RESPONSE_HEADERS_TRUNCATED

原文:https://www.cnblogs.com/arcsinw/p/11649275.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!