CSP Header Builder

Pick directives, add sources, copy a Content-Security-Policy for your server.

Runs in your browser
Directives12 active
  • Enable default-srcdefault-srcFallback for every fetch directive
    'self'
  • Enable script-srcscript-srcJavaScript sources
    'self''unsafe-inline'
  • Enable style-srcstyle-srcStylesheets and inline styles
    'self''unsafe-inline'
  • Enable img-srcimg-srcImages and favicons
    'self'data:https://secure.gravatar.com
  • Enable font-srcfont-srcWeb fonts
    'self'data:
  • Enable connect-srcconnect-srcfetch, XHR, WebSocket
    'self'
  • Enable frame-srcframe-srcIframes you embed
    https://www.youtube-nocookie.com
  • Enable frame-ancestorsframe-ancestorsWho may embed you (clickjacking)
    'self'
  • Enable object-srcobject-srcPlugins like <object>
    'none'
  • Enable base-uribase-uriAllowed <base> URLs
    'self'
  • Enable form-actionform-actionWhere forms may submit
    'self'
  • Enable upgrade-insecure-requestsupgrade-insecure-requestsRewrite http:// to https://
Output
Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' data: https://secure.gravatar.com; font-src 'self' data:; connect-src 'self'; frame-src https://www.youtube-nocookie.com; frame-ancestors 'self'; object-src 'none'; base-uri 'self'; form-action 'self'; upgrade-insecure-requests
356 bytes · Content-Security-Policy
script-src allows 'unsafe-inline'

Inline scripts defeat most of the XSS protection. Use nonces or hashes once your theme allows it.

More tools

All tools →