如何修复 "Content Security Policy - contains an invalid source" 错误?

How to fix "Content Security Policy - contains an invalid source" error?

我收到此错误,我不知道为什么,我包含的脚本有效? 并且错误仅在我加载子页面时出现。不是在我加载起始页时。 那我做错了什么?

The source list for Content Security Policy directive 'script-src' contains an invalid source: ''strict-dynamic''. It will be ignored.

<meta http-equiv="Content-Security-Policy" content="script-src *  'unsafe-inline' 'unsafe-eval' https://checkout.dibspayment.eu https://www.google-analytics.com https://maps.google.com;">

非常感谢任何意见,谢谢。

And the error only shows up when I load a subpage. Im getting this error and I don´t know why
The source list for Content Security Policy directive 'script-src' contains an invalid source: ''strict-dynamic''. It will be ignored.

这不是错误,只是警告您的浏览器不支持 'strict-dynamic' 标记。 (猜你用的是 Safari)。

我猜 subpage 是一些 Google 的 iframe(oAuth2、reCaptcha 等)。该 iframe publush 是它自己的 CSP,其中包含 'strict-dynamic' 令牌,并且此 CSP 是在浏览器 backward compatibility 模式下创建的(Google 如此)。

这是来自第三方 CSP 的警告,不是您的警告。

the scripts that I have included works?

您的父页面有自己的允许脚本的 CSP。嵌套浏览上下文(iframe)的 CSP 不影响父页面(frame-ancestors 指令除外)。

So what Im I doing wrong?

没有。这是内容安全策略的预期常规工作。
每个浏览上下文都可以有自己的 CSP。但是所有警告都会流向一个浏览器控制台,这是一种误导。