现象:

错误信息:

Access to XMLHttpRequest at ‘http://127.0.0.1:9581/GetInterface’ from origin ‘http://114.115.214.104:31102’ has been blocked by CORS policy: The request client is not a secure context and the resource is in more-private address space local.

在这里插入图片描述

错误原因:

新版的 Chromium 内核(可能是 93 或 94 版本)启用了新的安全策略,不再允许非 HTTPS 网站直接访问本地网络资源(CORS-RFC1918)

解决方案:

谷歌浏览器

步骤1: 谷歌浏览器 打开 chrome://flags/#block-insecure-private-network-requests
步骤2 : 找到 Block insecure private network requests. 设置为Disabled
步骤3 : 点击relaunch按钮重启谷歌浏览器,重新打开网页

在这里插入图片描述

edge浏览器

步骤1: 打开 edge://flags/#block-insecure-private-network-requests
步骤2 : 找到 Block insecure private network requests. 设置为Disabled
步骤3 : 点击relaunch按钮重启谷歌浏览器,重新打开网页

在这里插入图片描述

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐