When working with ExpressJS, the HTML file is loaded in the following manner:
app.use(express.static(__dirname + '/src/templates/'));
Within the HTML file, here is an example of a meta tag containing Content Security Policy:
<meta http-equiv="Content-Security-Policy" content="default-src 'self' https://cdnjs.cloudflare.com 'unsafe-inline' 'unsafe-eval' fonts.gstatic.com fonts.googleapis.com kit.fontawesome.com; img-src 'self' data:; object-src 'none'; require-trusted-types-for 'script'; script-src 'self' cdnjs.cloudflare.com">
The goal is to load external JS files as shown below:
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://kit.fontawesome.com/a4ff515084.js" crossorigin="anonymous"></script>
Despite specifying these external sources in the CSP meta tag, errors are encountered and the external JS files fail to load properly.
https://i.stack.imgur.com/KmfOl.png
Upon further investigation, certain issues have been identified:
https://i.stack.imgur.com/10eM4.png
Any assistance on resolving this matter would be greatly appreciated.