OneKitTools logoOneKitTools

CSP Generator

Generate Content Security Policy headers

About CSP Generator

Build a Content Security Policy header visually by configuring each directive — export as HTTP header, meta tag, or Nginx config snippet.

How to use CSP Generator

  1. 1Configure each CSP directive (default-src, script-src, style-src, img-src, etc.) by selecting allowed sources.
  2. 2Use 'self' to allow resources from your own domain, or add specific external domains.
  3. 3Avoid 'unsafe-inline' and 'unsafe-eval' unless absolutely necessary — they weaken your CSP significantly.
  4. 4Review the generated CSP header in the output panel.
  5. 5Copy the header value, the HTML meta tag, or download an Nginx configuration snippet.

Tips

  • Start strict (default-src 'none') and add sources incrementally — it's easier to loosen than to tighten.
  • Test your CSP in report-only mode first (Content-Security-Policy-Report-Only) to avoid breaking your site.
  • Use the Nginx snippet export to deploy your CSP directly in your server configuration.

Related tools

OneKitTools TeamUpdated 2.21.4