你好!
我们无法在我们的论坛上设置 GTM:https://forum.warthunder.com/
正如你所见,有一个关于内容安全策略的错误。
拒绝执行内联脚本,因为它违反了以下内容安全策略指令:“script-src https://forum.warthunder.com/logs/ https://forum.warthunder.com/sidekiq/ https://forum.warthunder.com/mini-profiler-resources/ https://forum.warthunder.com/assets/ https://forum.warthunder.com/brotli_asset/ https://forum.warthunder.com/extra-locales/ https://forum.warthunder.com/highlight_js/ https://forum.warthunder.com/javascripts/ https://forum.warthunder.com/plugins/ https://forum.warthunder.com/theme-javascripts/ https://forum.warthunder.com/svg-sprite/ https://www.googletagmanager.com/gtm.js 'nonce-857b78b0187f8ee53100212842747417' 'sha256-HZxBMVZe6P3MvHDZlFai9cUmLH+qwX6BNT3qTwNPATg='”。需要“unsafe-inline”关键字、哈希值('sha256-93qwY4D574Ysts67Kmc0jpUYGBwBuG9q6hhQl+Kk9us=')或 nonce('nonce-...')才能启用内联执行。
CSP 标头中的 URL 是正确的,nonce 也是正确的。
你知道可能是什么问题吗?
谢谢。
Lilly
(Lillian Louis)
2
hi @Nikolaos_SP
欢迎来到 Meta 
也许可以看看这个话题
2 个赞
你好莉莉
我读了那篇文章以及论坛上很多其他文章,但都没有帮助 
主页正确设置了 CSP 标头,脚本 src 中有 gtm 地址。还有一个 nonce,但浏览器仍然因为某些原因阻止脚本加载。
Jagster
(Jakke Lehtonen)
4
如果不使用 CSP,即“仅报告”模式,会发生什么?
1 个赞
如果我在管理面板中禁用内容安全策略,它就能正常工作。
但这会带来安全风险。
Jagster
(Jakke Lehtonen)
6
实际上风险并不大,即便有风险。CSP 是非常不可靠的方式,而且安全最终还是会出问题,因为如果想让事物正常工作,就必须允许很多东西。\n\n但对你来说,这是一个相当容易的抉择:你真的需要额外的安全层,还是需要谷歌标签?或者你可以改用 Matomo?
jboilesen
(Jonathan Boilesen)
7
1 个赞