Nginx CSP frame-src被忽略了

时间:2017-03-01 19:13:34

标签: nginx content-security-policy

我有一个Nginx CSP配置如下:

add_header Content-Security-Policy "default-src 'self';script-src 'self' 'unsafe-eval' https://www.google-analytics.com/analytics.js;img-src 'self' https://ssl.google-analytics.com data:;style-src 'self' 'unsafe-inline';font-src 'self' 'unsafe-inline';frame-src 'self' https:;object-src 'self';connect-src 'self' ws:;media-src 'self'

当我尝试在Chrome中加载页面时,我看到:

Refused to frame 'https://myexternalwebsite.com/a/b/index.html' because it violates the following Content Security Policy directive: "default-src 'self'". Note that 'frame-src' was not explicitly set, so 'default-src' is used as a fallback.

在我的CSP框架中,src设置清晰,其值为'self'和https:

我可能做错了什么?

1 个答案:

答案 0 :(得分:0)

有点奇怪,但我设法通过指定:

来解决这个问题
frame-src 'self' *;

这符合我的要求。