我有一个 s3 存储桶中的所有图像,我需要在主页和其他页面上显示它们。为了得到他们,我有这个代码:
<img src="https://bucket-name.s3.eu-west-3.amazonaws.com/cover/img-name.jpeg">
在 app.js 我使用这样的头盔:
app.use(helmet({
contentSecurityPolicy: {
useDefaults: true,
directives: {
// other directives
"img-src": ["'self'",
"https://bucket-name.s3.eu-west-3.amazonaws.com/*"
]
}
为什么我每次都会收到这个错误?
Refused to load the image '<URL>' because it violates the following Content Security Policy directive: "img-src 'self' data:".