2

我在我的网站上运行一个聊天应用程序,当我使用 HTTP 时一切正常,但是一旦我添加了 SSL 并开始使用 HTTPS,我的 websocket 连接就会出现以下错误:

[blocked] The page at 'https://localhost/test/' was loaded over HTTPS, but ran insecure content from 'ws://localhost:815/': this content should also be loaded over HTTPS.
 websocket.js:10

Uncaught SecurityError: Failed to construct 'WebSocket': An insecure WebSocket connection may not be initiated from a page loaded over HTTPS.

我尝试将 ws 更改为 wss 并删除这些错误,但该聊天仍然无法正常工作。

我使用 Godaddy 作为我的主机/服务器提供商。我是否需要更新 SSL 证书以告诉它以某种方式批准 wss 连接?

4

1 回答 1

0

也许在您的 html 文件中有一个指向包含 http 而不是 https 的脚本的链接

例子: <script src="http://code.jquery.com/jquery-2.1.1.min.js"></script>

应该: <script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>

于 2014-08-28T07:41:37.283 回答