Sphere
Log in Join
☆ 3

Why does my Content-Security-Policy break logs in Chrome?

I added default-src self and script-src self. A third-party script now refuses to load, and Chrome reports an inline script blocked.

⚑ Report

3 replies

☆ 0
L Laura ·2026-11-06#1

Read the console message: it prints the exact directive and sometimes a hash. If the script is inline, you need a nonce or a hash.

⚑ Report
☆ 0
N Nina ·2026-11-06#2

It is an inline bootstrap snippet I cannot move easily.

⚑ Report
☆ 0
M Meera ·2026-11-07#3

Generate a per-response nonce, put it on the script tag, and include it in script-src. Avoid unsafe-inline; it defeats most of the policy.

⚑ Report
Log in to reply.