javascript - ReactJS Axios 外部 API CORS
问题描述
我在我的 React 项目中使用外部 API
但是我在那里遇到了 CORS 错误
当我在谷歌搜索时,有很多文章建议在后端服务器上设置 CORS
但在我的情况下,我使用的是外部 API,我可以'不控制他们的后端添加 CORS
我可以在前端或浏览器内部禁用它而不接触后端吗?
这是错误代码
Access to XMLHttpRequest at 'https://externaldomain.com' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have HTTP ok status.
解决方案
推荐阅读
- karate - 如何在空手道的每个场景之后删除动态创建的资源?
- c - 是否可以在 C 中使联合右对齐?
- javascript - 如何接收和处理 Chrome 通知/推送通知?
- hibernate - Hibernate 5迁移:使用错误别名创建的映射实体的查询集合生成异常
- python - tensorflow LSTM model.predict
- python - 类和实例
- django - 什么是 Django 中的 self.instance?
- encryption - 基于模 m 的 RSA 字长
- node.js - 如何模拟 await dynamoDb.putItem(...).promise()?
- javascript - 响应客户端后如何在graphql解析器中继续处理?