CSP Header Generator

Fallback for any fetch directive you don't set explicitly.

Where <script> may load from. Avoid 'unsafe-inline' here.

Where stylesheets may load from.

Where images may load from. data: covers inline SVG and base64.

Where webfonts may load from.

Targets allowed for fetch, XHR, WebSocket, and EventSource.

(header only)

Who may embed this page in a frame. 'none' replaces X-Frame-Options: DENY.

Restricts <base href>, blocking a common injection trick.

Where forms on this page may submit to.

Response header

Content-Security-Policy: default-src 'self'

Meta tag

<meta http-equiv="Content-Security-Policy" content="default-src 'self'">

The response header is the better delivery method: frame-ancestors and report-uri are ignored inside a <meta> tag, so they are left out of it above. Test a new policy with Content-Security-Policy-Report-Only first — a wrong policy silently breaks scripts.

Powered by My Tiny Utils