CSP with Umbraco 12
# help-with-umbraco
j
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
m
a
Or use something like NWebsec.AspNetCore.Middleware
and you can do stuff like:
Copy code
csharp
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"))
you can build up your own CSP