CSP Header Generator
Build Content Security Policy headers
CSP Directives
Results
About CSP Header Generator
Build Content-Security-Policy headers with an interactive form. Generates HTTP header, meta tag, Nginx, and Apache configurations.
How It Works
Combines your directive values into a valid CSP header string. Outputs ready-to-use configurations for HTTP headers, HTML meta tags, Nginx add_header, and Apache Header directives.
Step by Step
- 1 Set source values for each CSP directive
- 2 Use 'self' for same-origin, specific domains, or 'none' to block
- 3 Click Generate to build the CSP header
- 4 Copy the configuration for your server type
- 5 Test the policy with browser DevTools
Tips
- Start with a restrictive policy and loosen as needed
- Use 'self' as a baseline for most directives
- Add CDN domains explicitly (e.g., cdn.jsdelivr.net)
- Test with Content-Security-Policy-Report-Only first