1

I have been having problems with scripts not getting loaded because of problems with content security policy settings and was wondering if there was a way to set a content security policy so that it lets all websites be accessible for downloading scripts?

Bill Noble
  • 6,466
  • 19
  • 74
  • 133

1 Answers1

3

If you're not sure exactly what Content Security Policy you need, it's fine to start with a policy that's very permissive, (which is at least better than no policy at all) and refine it.

For example,

Content-Security-Policy: default-src 'self'; script-src *

would allow you to include scripts from anywhere, but everything else, for example images, only from your own site.

I would also recommend you start with Content-Security-Policy-Report-Only, which reports errors but doesn't block the content. That way you can safely test and refine your policy before you enforce it.

See for example Scott Helme's blog article https://scotthelme.co.uk/content-security-policy-an-introduction/

Chris Denning
  • 903
  • 8
  • 15