问题描述:用chrome浏览器在线上发送ajax请求失败,提示:Access to XMLHttpRequest at 'http://10.---.--.--:xxx/api/setAppParam?time=Mon%20Oct%2011%202021%2016:39:51%20GMT+0800%20(%E4%B8%AD%E5%9B%BD%E6%A0%87%E5%87%86%E6%97%B6%E9%97%B4)' from origin 'http://210.37.8.219:11000' has been blocked by CORS policy: The request client is not a secure context and the resource is in more-private address space `private`.
而线下测试,以及使用ie浏览器都可以成功发送请求。
因此我断定是谷歌浏览器得问题,之后问了度娘,对浏览器进行设置,就解决了。
解决方案:
1,在浏览器地址栏输入:chrome://flags/#block-insecure-private-network-requests
2,将Block insecure private network requests功能禁用
3,重启浏览器,再次发送请求,就成功了!