Reputation: 23
I have a simple html page in my OSX, and it has a websocket client inside which must connect to my websocket server located on my website : wss://www.mydomain/wsserver Connection is not working on last version of Safari with OSX 10.12 but is working on Google Chrome and on Safaro 9.0.
I read this problem in a lot of forums thaat I must put the line:
<meta http-equiv="Content-Security-Policy" content="default-src * gap: data: blob: 'unsafe-inline' 'unsafe-eval' ws: wss:;">
But it doesn't work also. Do you know which is the correct line to add to tag?
Thanks.
Upvotes: 0
Views: 2757
Reputation: 23
The problem comes from the websocket server, based on Tomcat 8. Websocket server open a connection then when it sends a message to the client, the following exception is thrown: The client aborted the connection. On the client, the javascript error is:
WebSocket connection to 'wss://...' failed: Unexpected start character in header name.
No problems with other browsers like Chrome or Firefox.
Upvotes: 0
Reputation: 86
I faced the similar type of problem. After some investigations, I found that it occurred due to self signed SSL certificate. When I used a valid SSL CA certificate, the problem was fixed. Safari 10 does not allow self signed certificate for websocket.
Alternatively, you can use SockJs wrapper over websocket both in client side and server side. It will fallback to other protocols like xhr streaming when websocket is not available.
Upvotes: 1