错误结果:Failed to load resource: net::ERR_FAILED
错误信息:Access to XMLHttpRequest at 'http://127.0.0.1/xxxxx' from origin 'http://xxxxx.com' 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、最鸡肋的解决方法:更换使用旧版浏览器,或在新版浏览器修改对应的设置,如:edge://flags/#block-insecure-private-network-requests
2、最规范的解决方法:将站点迁移至 HTTPS 访问即可
3、最麻烦的解决方法:不要再使用此种访问方式,更换为其它业务逻辑。。。