【问题标题】:How to add content security policy in Node Js?如何在 Node Js 中添加内容安全策略?
【发布时间】:2023-02-04 15:35:20
【问题描述】:

如何为内容安全策略设置标头...

我在 Angular 中尝试过并设置标题

【问题讨论】:

    标签: node.js angular


    【解决方案1】:

    在 app.js 中设置标题 app.use((req, res, next) => { res.setHeader( 'Content-Security-Policy', "frame-ancestors 'self'; default-src 'unsafe-inline' 'self'; font-src 'unsafe-inline' 'self'; img-src 'self' 'unsafe-inline' blob: data: 'unsafe-eval'; script-src 'unsafe-inline' 'self'; style-src 'self' 'unsafe-inline'; frame-src 'unsafe-inline' 'self' "); 下一个(); });

    【讨论】:

      猜你喜欢
      • 2019-02-11
      • 2018-12-29
      • 2021-07-27
      • 1970-01-01
      • 1970-01-01
      • 2017-09-30
      • 2020-01-25
      • 2015-04-27
      • 1970-01-01
      相关资源
      最近更新 更多