A generic Content-Security-Policy copied from a hardening blog will break a Moodle™ course page. H5P, TinyMCE, LTI tools, MathJax, CDN fonts and a YouTube embed all load origins that a "scripts from self only" policy never lists. The browser then fails silently: a grey video box, a quiz that never starts, a login button that does nothing.
Write the policy from what the page actually loads. Here is a method that takes an afternoon on a staging site, not a rewrite of the application.
See the headers you already send
curl -sI https://lms.example.org/login/index.php | grep -iE 'content-security-policy|x-frame-options|strict-transport|x-content-type|referrer-policy|permissions-policy'
Enter fullscreen mode
Exit fullscreen mode
An empty grep is common. Moodle does not ship a production CSP.…