我很难将多个 url 添加为脚本源
我试过了:
- 将它们全部设置在同一个 ScriptSource 字符串中,但运行失败,说 url 无效
- 所以我将它们链接起来,但它不起作用,只有最后一个在标题中返回
chrome中收到的标头
content-security-policy: default-src 'self';script-src 'self' 'unsafe-inline' unpkg.com;style-src 'self' 'unsafe-inline';img-src 'self';block-all-mixed-content
content-security-policy-report-only: default-src 'self';img-src 'none'
.NET Core 方面:
app.UseCsp(opts => opts
.BlockAllMixedContent()
.DefaultSources(s => s.Self())
.ImageSources(s => s.Self())
.ScriptSources(s => s.Self())
.ScriptSources(s => s.UnsafeInline())
.ScriptSources(s => s.CustomSources("www.googletagmanager.com")
.CustomSources("www.googleanalytics.com")
.CustomSources("unpkg.com")
)
.StyleSources(s => s.Self())
.StyleSources(s => s.UnsafeInline())
);
有人可以帮我吗?
感谢您的帮助