Nginx content-security-policy 未被确认

Nginx content-security-policy not being acknowledged

我有一个 Nginx WordPress 站点和一些配置的代理重定向。我已经尝试将 CSP header 添加到我的 nginx.conf、我的 WordPress site/proxy 重定向站点文件,以及两者。出于测试目的,我将其设置为以下内容(其中 example.com 是我的域):

add_header Content-Security-Policy "default-src 'unsafe-inline' 'unsafe-eval' 'self' https://example.com;
                                    script-src 'unsafe-inline' 'unsafe-eval' 'self' https://example.com 'unsafe-inline' 'unsafe-eval' https://*.wp.com  https://ssl.google-analytics.com https:/$
                                    img-src 'unsafe-inline' 'unsafe-eval' 'self' https://example.com 'unsafe-inline' 'unsafe-eval' https://example.com https://ssl.google-analytics.c$
                                    style-src 'unsafe-inline' 'unsafe-eval' 'self' https://example.com 'unsafe-inline' 'unsafe-eval' https://example.com https://fonts.googleapis.com$
                                    font-src 'unsafe-inline' 'unsafe-eval' 'self' https://example.com 'unsafe-inline' 'unsafe-eval' https://example.com https://blog.hellodadiam.worl$
                                    frame-src 'unsafe-inline' 'unsafe-eval' 'self' https://example.com 'unsafe-inline' 'unsafe-eval' https://example.com https://assets.zendesk.com h$
                                    object-src 'unsafe-inline' 'unsafe-eval' 'self' https://example.com 'unsafe-inline' https://example.com;"
                                    always;

当我查看我的浏览器控制台时,我仍然得到这个 CSP:

Content-Security-Policy: default-src 'none'; frame-ancestors 'none'; script-src 'self'; img-src 'self'; style-src 'self'; base-uri 'self'; form-action 'self';

奇怪的是,这似乎不会影响 Firefox,即使它与其他浏览器一样header。

对于代理,当我直接连接到它们时它们工作正常所以它一定是 Nginx 的东西。

我是不是遗漏了什么或者配置有误?

我意识到我只是恐慌。我再次查看了 Nginx 配置,发现了一个 Certbot auto-added 的选项文件。里面有我正在寻找的锁定 CSP。我刚刚注释掉了那一行,一切正常。

Certbot 在站点配置文件中添加了这一行:

include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot 

在该文件中是我在浏览器上看到的 CSP:

add_header Content-Security-Policy "default-src 'none'; frame-ancestors 'none'; script-src 'self'; img-src 'self'; style-src 'self'; base-uri 'self'; form-action 'self';";