我在公司环境中工作,发现了一个我无法解决的问题。
它与EventSource
将 URL 参数从更改HTTP
为HTTPS
.
const url = 'http://localhost:8080'; // <-- using HTTP not HTTPS
new window.EventSource(url);
这导致浏览器抛出此错误:
GET https://localhost:8080 net::ERR_TUNNEL_CONNECTION_FAILED
我正在使用的网站上进行开发,HTTPS
所以也许这是设计使然,它使用相同的协议。有人遇到过这个问题或知道如何解决吗?
- - 更新 - -
看起来这是设计使然。在另一个 HTTPS 站点上尝试此操作时,我得到了以下信息:
Mixed Content: The page at 'https://...' was loaded over HTTPS, but requested an insecure EventSource endpoint 'http://localhost...'. This request has been blocked; the content must be served over HTTPS.
问题仍然存在,我该如何解决这个问题?