I am using next@12 to generate the CSP using the next.config.js and this is the error I receive inside my console:
The Content-Security-Policy directive name 'amazonaws.com' contains one or more invalid characters. Only ASCII alphanumeric characters or dashes '-' are allowed in directive names.
Here is the header I'm using:
{
key: "Content-Security-Policy",
value: "amazonaws.com *.amazonaws.com cloudinary.com *.cloudinary.com",
},
According to web.dev:
script-src directive is missing. This can allow the execution of unsafe scripts.
Missing object-src allows the injection of plugins that execute unsafe scripts. Consider setting object-src to 'none' if you can.
I try to set there parameters but It crashes my site. I'm probably doing it wrong. Any idea how to go about setting these rightly?