在 https://上使用 ws://(混合内容) [英] Using ws:// while on https:// (mixed content)

查看:152
本文介绍了在 https://上使用 ws://(混合内容)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 html5 页面

I have a html5 page with

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

但我收到一个错误

混合内容:位于https://foo.bar/"的页面通过 HTTPS 加载,但试图连接到不安全的 WebSocket 端点'ws://foo.bar:8888/'.此请求已被阻止;这个端点必须在 WSS 上可用.

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-running-insecure-content 或类似的东西启动 chrome 之外,有什么方法可以使这项工作正常进行吗?

I understand that, but I can't serve a Secure Websocket. Is there any way to make this work, except starting chrome with --allow-running-insecure-content or something like that, where the user has to do something?

谢谢!

推荐答案

所以几个月后我可以说:如果你可以通过 https 提供页面在你的服务器上的某个地方有证书和链文件,使用这些来提供 wss

So months later I can say: If you can serve the page via https somewhere on your server there are certificate and chain files, use these to serve a wss

这篇关于在 https://上使用 ws://(混合内容)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆