#CSP with Umbraco 12

1 messages · Page 1 of 1 (latest)

hallow fiber
#

How do you set up a CSP to stop it firing when in the CMS? Not using a middleware. Or use middleware ONLy to check if you are in /umbraco

grave mortar
craggy mountain
#

Or use something like NWebsec.AspNetCore.Middleware

#

and you can do stuff like:

app.UseWhen(
            x => x.Request.Path.ToString().StartsWith("/umbraco"),
            builder => builder
                .UseCsp(options => options
                    .DefaultSources(s => s
                        .Self())
                    .ImageSources(s => s
                        .Self()
                        .CustomSources(
                            "blob:",
                            "data:",
                            "dashboard.umbraco.com",
                            "*.googleapis.com",
                            "*.gstatic.com"))