我的Google Analytics上没有任何跟踪信息...我怀疑我的内容安全策略是错误的,即使浏览器控制台是干净的。这是我目前拥有的:
Header always set Content-Security-Policy "script-src 'self' https: data: 'unsafe-inline' 'unsafe-eval' https://www.googletagmanager.com img-src: https://www.googletagmanager.com connect-src: https://www.googletagmanager.com;"
在这个问题上有什么建议吗?最好的。
2条答案
按热度按时间kcrjzv8t1#
connect-src
和img-src
不应该有冒号。也可以用分号结束每个策略。但是我相信你可能还需要一些来自谷歌的其他主机。如果你在你的CSP中添加一个report-to,你可以看到什么被阻止了。我还想建议不允许不安全的内联js(当然如果可能的话)
1aaf6o9v2#
Google建议使用some CSP policies:
但是为了保持HTTP头的苗条,我仍然想知道如何事先知道required TLDs。