Rocket Loader CSP Rules

hey, I am trying to get rocket-loader.min.js up and running with my strict CSP rules: default-src 'none'; base-uri 'none'; object-src 'none'; form-action 'none'; frame-ancestors 'none'; img-src 'self'; style-src-elem 'self'; script-src 'self' 'unsafe-inline' 'strict-dynamic' 'nonce-ucmPnqpppC8CN4vHqOAoh+859cskzJ0gflqKZ//2OHI=' static.cloudflareinsights.com ajax.cloudflare.com; connect-src 'self' cloudflareinsights.com; require-trusted-types-for 'script' based on the documentation I have added ajax.cloudflare.com but it looks like the rocket-loader is not loaded from ajax.cloudflare.com domain. Firefox gives me such error:
Content-Security-Policy: The page’s settings blocked a script (script-src-elem) at https://<website>/cdn-cgi/scripts/7d0fa10a/cloudflare-static/rocket-loader.min.js from being executed because it violates the following directive: “script-src 'self' 'unsafe-inline' 'strict-dynamic' 'nonce-ucmPnqpppC8CN4vHqOAoh+859cskzJ0gflqKZ//2OHI=' https://static.cloudflareinsights.com https://ajax.cloudflare.com”
Content-Security-Policy: The page’s settings blocked a script (script-src-elem) at https://<website>/cdn-cgi/scripts/7d0fa10a/cloudflare-static/rocket-loader.min.js from being executed because it violates the following directive: “script-src 'self' 'unsafe-inline' 'strict-dynamic' 'nonce-ucmPnqpppC8CN4vHqOAoh+859cskzJ0gflqKZ//2OHI=' https://static.cloudflareinsights.com https://ajax.cloudflare.com”
Is there any way to fix it?
2 Replies
Chaika
Chaika5mo ago
https://csp-evaluator.withgoogle.com/ is really helpful for troubleshooting CSP Issues. For example, strict-dynamic is making everything but the nonce be ignored (including 'self', etc) and having the nonce makes 'unsafe-inline' ignored
CSP Evaluator
CSP Evaluator
Chaika
Chaika5mo ago
Rocket Loader isn't very useful these days though and can break/slow down modern websites more then it helps, unless you have a website with a ton of different files js like old wordpress and such you can't manually async/defer, not too helpful
Want results from more Discord servers?
Add your server