Solution for Magento 2.4.6 or above
You can bypass the Magento_CSP by using the around plugin:
Create your di.xml in any custom module
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<type name="Magento\Csp\Observer\Render">
<plugin name="ByPassCSPValidation" type="Vendor_Module\Plugin\ByPassCSPValidation" />
</type>
</config>
Create a Plugin Vendor\Module\Plugin\ByPassCSPValidation
<?php
namespace Vendor\Module\Plugin;
use Magento\Csp\Observer\Render;
class ByPassCSPValidation
{
public function aroundExecute(Render $subject, callable $proceed)
{
// Do nothing
}
}
Thanks