I have a HTML/EJS webpage with the following Content Security Policy in the head tag:
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; style-src 'self' 'unsafe-inline' https://maxcdn.bootstrapcdn.com https://fonts.googleapis.com; frame-src https://externalpage.com/">
As can be seen, I have stated a URL for the "frame-src" in order to load an external iframe into the page. This, however, is not functional. The error is the following:
"Refused to frame 'https://externalpage.com/' because it violates the following Content Security Policy directive: "default-src 'self'". Note that 'frame-src' was not explicitly set, so 'default-src' is used as a fallback."
The iframe is similar to the following:
<iframe width="256" height="256" style="display:inline-block;border:none;" src="//externalpage.com/ect/long/remainder/of/url/link/here</iframe>
The error message persists even if I remove the 'default-src' directive. I have also tried to define a 'wildcard' as "https://externalpage.com/*" without success. I also do not understand why the error indicates that I have not set a 'frame-src' directive, when I clearly have. What am I to do to resolve this...????
In addition as can be seen I was forced to add an "unsafe-inline" rule in order to allow inline styling, such as "div class="container-fluid" style="margin-top:30px"" ...is there some way to get around this? I know the 'unsafe-inline' should not be used due to security issues.
This Content Security Policy nonsense is madness.