内容安全政策拒绝连接

时间:2017-01-10 21:42:19

标签: security http-headers content-security-policy

  

拒绝连接   ' https://w1xxx.ldxxx.net:7031/direct/v1609/something?preview=FALSE'   因为它违反了以下内容安全策略指令:   " default-src' unsafe-inline' ' unsafe-eval' self' * .googleapis.com   * .google-analytics.com * .gstatic.com * .googletagmanager.com aaa.dev.someplace.com * .test.ldxxx.net * .testauto.ldxxx.net   w1xxx.ldxxx.net aaa.xxz.ldxxx.net aaa.test.someplace.com   aaa.staging.aaac.net aaa.yyy.ddd.as.nz"。请注意,' connect-src'是   没有明确设置,所以' default-src'被用作后备。

请记住,我已经掩盖了网址,因为没有泄露敏感信息。

我的确切content-security-policy http标头位于引用的错误文本中。错误表明:

https://w1xxx.ldxxx.net:7031/direct/v1609/something?preview=FALSE

违反了我的内容安全政策。但为什么?由于我的内容安全政策中的https://w1xxx.ldxxx.net:7031/direct/v1609/something?preview=FALSE,是否应该允许w1xxx.ldxxx.net被连接?

1 个答案:

答案 0 :(得分:1)

定义策略的页面的URL是什么,以及发生此违规的位置?

如果未在端口7031上提供此页面,则必须在策略中指定w1xxx.ldxxx.net:7031作为主机条目。

根据CSP specification,如果未指定端口,则默认为URL方案中的端口(默认HTTPS使用443)。

  

如果表达式不包含port-part,则url的端口不是   url方案的默认端口,返回"不匹配"。