Zle*_*erp 1 reactjs mixed-content axios
我构建了一个 React 项目只是为了尝试一些东西,我在使用SWAPI (Star Wars API)时遇到了问题。
Mixed Content Error
在我的 React 项目中尝试通过 axios 使用他们的 API 时,我不断收到 。
Mixed Content: The page at 'https://zlerp.github.io/react-StarWars/#/people/2' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://swapi.dev/api/people/3/'. This request has been blocked; the content must be served over HTTPS.
即使我用 硬编码 URL https://swapi.dev/api/people/3/
,我仍然收到混合内容错误。
非常感谢任何和所有帮助。
你可以在这里看到错误:https : //zlerp.github.io/react-StarWars/#/people/3
响应位置显示http
可能与问题有关吗?如果是这样,我该如何改变?
这与在您的站点加载 https 时在 http 上提供 api 的事实有关,因此浏览器会阻止请求。
由于您无法控制第 3 方 api 的事实,因此您可以解决添加元标记的问题 <meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
归档时间: |
|
查看次数: |
1489 次 |
最近记录: |