连接到在AWS Beanstalk上运行的GO Websocket服务器

时间:2018-10-11 19:39:16

标签: amazon-web-services go websocket amazon-elastic-beanstalk

我有一个内置的websocket服务器,可以在AWS beantalk上运行。我正在运行带有SSL证书的负载平衡器。我在通过浏览器连接到它时遇到问题。如果我尝试通过在我的终端上运行的另一个go程序连接到它,则一切正常。我已经更新了环境,以接受TCP代替端口HTTP上的80连接。

当我尝试从Web应用程序连接时,尽管出现此错误。

WebSocket connection to 'wss://root.com/users/fcbd7f8d-2ef6-4fe2-b46c-22db9b107214/sockets/client' 
failed: Error during WebSocket handshake: Unexpected response code: 400

当我检查AWS日志时,发现此错误。

the client is not using the websocket protocol: 
'websocket' token not found in 'Upgrade' header

更新

如果我在本地主机上运行webapp并将连接字符串从wss://更改为ws://,则它将起作用。如果我在实时网络应用中尝试使用相同的网址,则会收到ssl错误。

Mixed Content: The page at 'https://root.com/captions' was loaded over HTTPS, 
but attempted to connect to the insecure WebSocket endpoint 
'ws://root.com/users/fcbd7f8d-2ef6-4fe2-b46c-22db9b107214/sockets/client'. 
This request has been blocked; this endpoint must be available over WSS.

0 个答案:

没有答案