在我的 Netlify 函数中,我有以下 API 调用:
const response = await axios.get('https://api.openweathermap.org/data/2.5/weather');
然后我将它部署到站点,在控制台中浏览器说:
<块引用>阻止加载混合活动内容
我已经完成了我的研究,当您通过 HTTPS 站点发出 HTTP 请求时,似乎会发生这种情况,但该请求明确表示 HTTPS。
此外,当我在本地运行该项目时,它运行良好。
答案 0 :(得分:0)
尝试添加此元标记 <meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
在想要从 HTTP 迁移到 HTTPS 的域 example.com 上设置此标头后,非导航不安全资源请求会自动升级(第一方和第三方)当事人要求)。查看mozilla