我们正在使用 magento 2,并在网站上启用了 Cloudflare,但是当我们尝试安装 Matomo 时,在浏览器控制台上遇到此问题 -
index.php:1 Refused to load the script 'https://static.cloudflareinsights.com/beacon.min.js/vcd15cbe7772f49c399c6a5babf22c124171
7689176015' because it violates the following Content Security Policy directive:
"default-src 'self' 'unsafe-inline' 'unsafe-eval'". Note that 'script-src-elem' was not
explicitly set, so 'default-src' is used as a fallback.
您需要将 csp_whitelist.xml 中的 cloudflare 域名列入白名单。
有关更多详细信息,您可以查看 Magento 2 donc https://developer.adobe.com/commerce/php/development/security/content-security-policies/