我正在使用 npm 头盔来保护我的 express 应用程序,但我想允许我的 S3 存储桶中的图像进行渲染。当我使用有意义的 helment 时出现此错误Refused to load the image '<URL>' because it violates the following Content Security Policy directive: "img-src 'self' data:".
,我违反了头盔实现的 CSP。
我在他们的文档中唯一能找到的是:
app.use(
helmet({
contentSecurityPolicy: false,
})
);
这确实允许我的图像渲染,但我仍然想要头盔提供的 CSP。我只需要基本上将我的 S3 链接列入白名单,但我在他们的文档中找不到关于此主题的任何内容