gpt4 book ai didi

javascript - Chrome 98 私有(private)网络访问问题与/禁用网络安全 : Request had no target IP address space, 获取资源在本地地址空间中

转载 作者:行者123 更新时间:2023-12-05 00:25:10 29 4
gpt4 key购买 nike

我们在公共(public)站点上有一个测试环境。在那里,我们在 chrome 上使用 --disable-web-security 标志,让测试人员在手动测试阶段绕过公共(public)服务调用的 CORS 错误。而且我们在代理机器上有 localhost 请求。然而,今天随着 Chrome 98 的更新,我们开始为针对 localhost 的网络请求而苦苦挣扎。
我们得到的错误是来自公共(public)站点的 localhost 请求:Access to XMLHttpRequest at 'https://localhost:3030/static/first.qjson' from origin 'https://....com' has been blocked by CORS policy: Request had no target IP address space, yet the resource is in address space `local`.localhost 上的站点配置为返回 Access-Control-Allow-* CORS header ,包括“Access-Control-Allow-Private-Network: true”。
而且我没有看到任何预检请求。只有一个带有 CORS 错误的 GET 请求。
我们怀疑这可能是您通过 --disable-web-security 禁用 Web 安全时引起的副作用。它可能会阻止获取目标 IP 地址空间。我们的假设基于 https://wicg.github.io/private-network-access/ 上的 CORS 预检部分

3.1.2. CORS preflight
The HTTP fetch algorithm should be adjusted to ensure that a preflight is triggered for all private network requests initiated from secure contexts.

The main issue here is again that the response’s IP address space is not known until a connection is obtained in HTTP-network fetch, which is layered under CORS-preflight fetch.


那么有人知道使用 --disable-web-security 标志的专用网络访问的任何解决方法吗?
或者,也许我们遗漏了一些东西。谢谢您的帮助。

最佳答案

下面的步骤可以帮助解决 chrome 98 中的问题,对于像 edge 这样的其他浏览器,你需要像 chrome 一样做类似的事情。
对于 MAC

  • 请求使用 chrome 版本 98。您需要按照以下步骤操作:- 在终端上运行此命令defaults write com.google.Chrome InsecurePrivateNetworkRequestsAllowed -bool true
  • 重新启动您的浏览器,不起作用然后重新启动您的机器

  • 对于 WINDOWS
  • 运行“regedit”以打开 Windows 注册表(如果出现权限问题,则使用管理员命令提示符运行该命令)
  • 转到计算机\HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Google\Chrome
  • 使用“InsecurePrivateNetworkRequestsAllowed”名称创建新的 DWORD 值
  • 将值更改为“1”
  • 重启浏览器
  • 关于javascript - Chrome 98 私有(private)网络访问问题与/禁用网络安全 : Request had no target IP address space, 获取资源在本地地址空间中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71018461/

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