拒绝加载图像“<URL>”,因为它违反了以下内容安全策略指令:“img-src 'self'数据:”

Amm*_*Lee 4 mongoose node.js cloudinary content-security-policy vue.js

当我在 herokuy 上上传我的网站后,图像无法正常工作,它给了我这个错误

拒绝加载图像“”,因为它违反了以下内容安全策略指令:“img-src'self'数据:”。

我尝试过类似的事情

<meta http-equiv="Content-Security-Policy" content="default-src 'self'; font-src data:" />

但它也不起作用

小智 5

app.use(helmet({ crossOriginEmbedderPolicy: false, originAgentCluster: true }));
app.use(
  helmet.contentSecurityPolicy({
    useDefaults: true,
    directives: {
      "img-src": ["'self'", "https: data: blob:"],
    },
  })
);
Run Code Online (Sandbox Code Playgroud)