如何通过META标签更改内容安全策略?

发布于 2025-01-26 13:33:42 字数 488 浏览 3 评论 0原文

我构建了一个MERN应用程序,其中我使用条纹进行付款,但是当我通过Heroku上传时,以下错误会出现:

输入映像”>

我尝试在index.html的标题中设置内容安全策略元标记

  <meta http-equiv="Content-Security-Policy" content="default-src *; script-src *; img-src *; connect-src * ; style-src *; font-src * ">

我还使用头盔将标头设置为:

app.use(
  helmet()
);

请仅一些方法来删除此错误。

I build a MERN app in which I used Stripe for payments but when I upload it over heroku the following error comes:

enter image description here

I tried to set Content Security Policy meta tag in header of index.html as

  <meta http-equiv="Content-Security-Policy" content="default-src *; script-src *; img-src *; connect-src * ; style-src *; font-src * ">

Even then I got the same error while I set script-src to '*'.

I have also used helmet to set headers as:

app.use(
  helmet()
);

Please just some ways to remove this error.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

小清晰的声音 2025-02-02 13:33:42

通过添加另一个CSP,您不能通过添加另一个CSP放松,结果只会变得更加严格。您需要确定设置先前存在的CSP的何处以及如何修改,以允许您需要运行的任何内容。

You can't relax a CSP by adding another one, by adding another one the result can only become stricter. You need to identify where and how the preexisting CSP is set and modify it to allow whatever you need to run.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文