edge has been blocked by CORS policy: The request client is not a secure context and the resource is in more-private address space `private`.
时间: 2023-09-21 16:09:51 浏览: 46
这个错误是由于浏览器的跨域资源共享(CORS)安全策略所导致的。浏览器会阻止不同源之间的资源请求。在你的情况下,请求客户端不是安全上下文,而资源位于更私有的地址空间“private”中,因此请求被阻止了。为了解决这个问题,你需要在资源服务器上设置 CORS 头,允许跨域访问。具体的解决方法可以参考相关文档或者咨询相关技术人员。
相关问题
has been blocked by CORS policy: The request client is not a secure context and the resource is in more-private address space `private`.
"has been blocked by CORS policy: The request client is not a secure context and the resource is in more-private address space `private`"这条错误提示表示浏览器阻止了跨域请求,因为请求的客户端不是在安全上下文中,并且请求的资源位于更私密的地址空间中,是私有的。这种错误通常发生在浏览器的安全策略中,用于防止潜在的安全风险。浏览器要求跨域请求必须在安全的上下文(如HTTPS)中进行,而且请求的资源必须是公共可访问的,而不是私有的。如果您遇到这个错误,您可以考虑以下几种解决方法:
1. 确保请求的客户端位于安全上下文中,使用HTTPS协议发送请求而不是HTTP。
2. 确保请求的资源是公共可访问的,而不是私有的。如果资源是私有的,您可以考虑将其设为公共可访问或在服务器端进行适当的配置。
3. 检查浏览器的安全策略设置,确保没有禁用或限制跨域请求。您可以查看浏览器文档或搜索特定浏览器的解决方案来了解如何配置安全策略。
请注意,解决这个问题可能需要对您的应用程序或服务器进行适当的配置和调整,以确保安全性和正确的跨域访问。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *3* [【网络安全】Chrome 94 CORS private adress 问题](https://blog.csdn.net/th3383193/article/details/128226602)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"]
- *2* [has been blocked by CORS policy: The request client is not a secure context and the resource is in..](https://blog.csdn.net/xiaoyuer_2020/article/details/125184448)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
nginx has been blocked by CORS policy: The request client is not a secure context and the resource is in more-private address space `local`.
nginx被CORS策略阻止的原因是请求客户端不是安全上下文,并且资源在更私有的本地地址空间中。解决此问题的一种方法是在nginx配置文件中添加以下内容:
```nginx
location / {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range';
}
```
这将允许所有来源的请求访问nginx服务器,并允许使用GET,POST和OPTIONS方法。此外,还将允许使用特定的请求头。
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)