Research library / Installation & diagnostics

Chatbot blocked by Content Security Policy: diagnose the right directive

Inspect the CSP error and blocked resource type before changing policy. Script, connection and frame directives govern different widget resources; multiple enforced policies may restrict a resource simultaneously.

Find your next diagnostic step

Editorial review: 2026-11-26 · MDN CSP reference · PIP research, not a live vendor performance test.

Decision path

Work through the problem

Read violationIdentify blocked resource and directive in Console.
Find policyInspect headers and any applicable meta policy.
Verify originUse official requirements and resource types.
TestValidate on staging, including negative security cases.

Practical example

A common situation

A widget script loads but its frame or network requests fail. Allowing the script origin does not automatically permit other resources. Record the actual violation and verify all effective policies; a permissive additional policy cannot override a stricter one.

PIP illustration: Blocked request; Policy directive; Approved origin. Implementation concept; follow documented steps and verification checks.

Implementation concept; follow documented steps and verification checks.

Implementation guide

Where to go and what to check

Start here: Browser DevTools → Console and Network → document response headers; record the actual directive and blocked origin.

  1. Capture the violation and relevant resource type. Inspect enforced Content-Security-Policy headers and applicable meta policy.
  2. Identify the directive and exact documented required origins; check fallback rules where a directive is absent. Do not use blanket wildcards or remove the policy.
  3. Stage a narrowly reviewed change. Verify the intended widget and test that an unapproved origin remains blocked; every enforced policy must permit the intended resource.

What a passing test looks like

Actual violation and enforced policies recorded

Exact necessary origin permitted by reviewed directive

Widget works; unrelated origin still blocked

Interactive troubleshooting

What are you seeing?

Recommended next check

Identify script-src or applicable fallback and exact vendor origin.

See all diagnostic paths
Script refused
Identify script-src or applicable fallback and exact vendor origin.
Widget opens but calls fail
Inspect connect-src and actual blocked endpoint.
Frame refused
Inspect frame-src and embedding constraints; verify requirements.

This is a diagnostic guide, not a test of your website. Verify actual configuration before changing it.

Verification checklist

Before you call this complete

0 of 3 confirmed

Checklist state is local to this page and is not submitted or stored.

PIP illustration: Blocked request; Relevant CSP directive; Approved exact origin. Investigate the blocked request before changing policy.

Investigate the blocked request before changing policy.

Practical questions

Frequently asked questions

Why does the script load but chat fail?

A subsequent connection or frame may violate connect-src or frame-src.

Should I add unsafe-inline?

Not as a generic fix. Use reviewed origins and appropriate nonce/hash handling for authorised inline code.

Evidence and limitations

Primary sources

Vendor documentation and browser guidance informed the steps. Scenarios are illustrative; we have not accessed your installation. Preserve your site’s security and consent requirements.

PIP Intelligence

Find a resource

Choose a resource below.