今天给公司第三方服务页面加js脚本,线上正常;测试环境报一下错误:
Access to script at 'xxx' from origin 'xxx.xxx.xxx.xxx:8888' has been blocked by CORS policy: The request client is not a secure context and the resource is in more-private address space `private`.
即公网地址访问私域资源浏览器拦截报跨域问题。
解决方案如下:
1.chrome浏览器输入:chrome:``//flags/#block-insecure-private-network-requests
设置:block-insecure-private-network-requests为 disabled 重启即可;
2.都改成https
3.做代理或改dns 两种地址都改成 内网或者外网ip