【发布时间】:2020-12-13 17:32:46
【问题描述】:
我正在尝试将 react 应用程序部署到 Heroku。我有一个 NodeJs/Express API,它正在为我使用 create-react-app 创建的应用提供服务。
我正在尝试在我的站点上的外部 API (https://www.thecocktaildb.com) 的标签中显示图像,但在生产中我继续收到以下错误:
Refused to load the image '<URL>' because it violates the following Content Security Policy directive: "img-src 'self' data:".
我尝试在我的 public/index.html 文件中使用以下代码 sn-p 的许多变体来解决这个问题,但到目前为止没有任何效果。
<meta
http-equiv="Content-Security-Policy"
content="img-src 'self' https://www.thecocktaildb.com data:;"
/>
我已经用完了可以尝试的东西,并且无法在任何地方找到解决方案。请帮忙。
【问题讨论】:
标签: node.js reactjs express heroku create-react-app