I am experiencing an issue with Magento 2 where the checkout page is not loading correctly. Upon investigating, it appears that the Content Security Policy (CSP) is blocking inline scripts, which seems to be preventing the checkout from functioning properly.
In addition to the general checkout issue, I’ve noticed that my payment gateway’s inline script is also being blocked.
This is how my console looks like.
Upon investigating further, it appears that CSP will not allow executing inline scripts unless I add a nonce to the script tag like this:
<script type="text/javascript" nonce="<?php echo $nonce; ?>">
// Your inline JavaScript code here
</script>
I have also gone through the official documentation, but I haven’t had any luck resolving this issue.