如何通过META标签更改内容安全策略?
我构建了一个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:
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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
通过添加另一个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.