How to debug Safari silently failing to connect to a secure WebSocket

前端 未结 2 1619
走了就别回头了
走了就别回头了 2020-12-06 18:25

When doing new WebSocket(\'ws://server/\'); Safari connects fine, but when using new WebSocket(\'wss://server/\'); it completely fails (returns a <

2条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-06 18:53

    Where I've seen this, it means there is something wrong with the certificate (expired, incorrect domain, etc). Try connecting directly to the WebSockets server from Safari, i.e. https://wss_server:wss_port/. Safari should give you a better error message that way.

    When I had this problem while developing wsproxy as part of noVNC (HTML5 VNC client) it turned out I was using an IP for the server but the certificate was signed for a hostname.

提交回复
热议问题