在 https:// 上使用 ws://(混合内容)

Using ws:// while on https:// (mixed content)

我有一个 html5 页面

var connection = new WebSocket('ws://foo.bar:8888');

但是我得到一个错误

Mixed Content: The page at 'https://foo.bar/' was loaded over HTTPS, but attempted to connect to the insecure WebSocket endpoint 'ws://foo.bar:8888/'. This request has been blocked; this endpoint must be available over WSS.

我明白了,但我无法提供安全 Websocket。 有什么方法可以使这项工作正常进行,除了使用 --allow-运行-insecure-content 或类似的东西开始 chrome,用户必须在其中做些什么?

谢谢!

所以几个月后我可以说:如果您可以通过 https 在您服务器上的某处提供该页面,则有证书和链文件,请使用它们来提供 wss