我很难将多个urls添加为脚本源
我试过:
中返回。
以铬表示的标头
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核心侧:
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())
);有人能帮我吗?
谢谢你的帮忙
发布于 2021-03-18 11:17:21
好的,我终于找到了,它是一个params参数,所以没有数组,只是字符串被,
.ScriptSources(s => s.CustomSources("www.googletagmanager.com","www.googleanalytics.com","unpkg.com")
)https://stackoverflow.com/questions/66687725
复制相似问题