Base64图像内容安全策略错误

问题描述 投票:0回答:1

我正在尝试将base64字符串加载到img src中,在我的本地环境中这是可行的,但在实时环境中,我会收到此错误:click for error:

我也尝试将其放在我的html标头中:

<meta http-equiv="Content-Security-Policy" content="default-src *; img-src * 'self' data: https:; script-src 'self' 'unsafe-inline' 'unsafe-eval' *; style-src  'self' 'unsafe-inline' *">

我真的被这个问题困扰,因为因此我无法部署到实时环境中。.非常感谢您的帮助。

http-headers content-security-policy
1个回答
0
投票

根据错误消息,您在初始CSP中缺少default-src的“数据:”(删除引号)。如果定义img-src,则应在其中添加“数据:”。

© www.soinside.com 2019 - 2024. All rights reserved.