Magento 2
Content Security Policy XML
Free Preview
<?xml version="1.0" encoding="UTF-8"?>
The HTTP Content-Security-Policy response header allow you to control what pages to load for specific
user agents.

This mostly involves defining rules for specific origins or script endpoints, and helps guard against
cross-site scripting attacks (XSS).
    <!-- Magento expects a "policies" node, with any number of "policy" children nodes. -->
        <!-- The id to specify here is what sets the "key" of the Content-Security-Policy header. -->
        <policy id="script-src">
                This is the "value" to the Content-Security-Policty key:value store.
                The id is arbitrary but must be unique, while the type is expected to be "host".
                The value for this child is finally the full URL you wish to allowlist.
              <value id="jsdelivr" type="host"></value>

The above nodes create an HTTP header that resembles:

Content-Security-Policy: script-src 'self';

This will allow HTTP requests made to to succeed.
Want to learn more?

Visit to learn much more about Magento, Laravel, PHP, Javascript, & Docker. logo