gpt4 book ai didi

javascript - Microsoft Edge 阻止发送到同一专用网络 CIDR 中的 IP 的跨域请求

转载 作者:行者123 更新时间:2023-12-01 05:33:44 29 4
gpt4 key购买 nike

$.ajax({
url: "http://10.13.22.150/req_path",
success: function(result){
console.log(result);
}
});

我想将跨域 XMLHttpRequest 发送到专用网络中的 IP 地址。但是,开发者工具控制台中显示以下错误:

SCRIPT7002: XMLHttpRequest: Network Error 0x2efd, Could not complete the operation due to error 00002efd.

根据Wireshark的说法,数据包不是从客户端发送的。我猜该请求已被 Microsoft Edge 阻止此外,我发现只有当 XMLHttpRequest 和 Edge 客户端的 url 位于同一私网 CIDR 中时,请求才会被阻止。

Client IP             Request URL            Result
192.168.x.x send to 192.168.x.x ->>>>> X
10.13.x.x send to 10.13.x.x ->>>>> X
10.13.x.x send to 192.168.x.x ->>>>> O

其他浏览器(例如 IE11/Chrome/Firefox)也可以正常工作。这种情况仅在 Microsoft Edge 中出现。对于这个问题有什么解决办法吗?

最佳答案

来自Understanding Enhanced Protected Mode

Private Network resources

Because EPM does not declare the privateNetworkClientServer capability, your Intranet resources are protected from many types of cross-zone attacks (usually called “Cross-Site-Request-Forgery (CSRF)” and “Intranet Port Scanning.”) Internet pages are not able to frame Intranet pages, load images or resources from them, send them CORS XHR requests, etc.

以上所有内容似乎都适用于 MS Edge。 Edge 唯一缺少的东西(至少在这一点上,v20.10240)是安全区域设置。

我的问题不在于 XMLHttpRequest,而在于尝试在互联网页面内的 iframe 中加载 Intranet 页面。解决方法涉及更改我的网络设置 - 请参阅 https://stackoverflow.com/a/32828629

关于javascript - Microsoft Edge 阻止发送到同一专用网络 CIDR 中的 IP 的跨域请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35293904/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com