HTTP Security Headers & CSP Generator
Build Content-Security-Policy (CSP), HSTS & X-Frame-Options headers and export for Cloudflare Pages, Nginx, or Vercel.
Using CSP & Security Headers manually? Batch-process live URLs with CleanPage Edge API or Apify Cloud Actors.
Recommended Hosting & SaaS Stack
Affiliate PartnersNVMe SSD hosting + free domain & SSL for launching static or WordPress client sites fast.
Register clean .com / .dev / .ai domains with free lifetime Whois privacy and fast DNS.
Deploy Node.js APIs, containers, and managed Postgres databases with predictable developer pricing.
How to Use CSP & Security Headers & Key Capabilities
Quick Workflow
- Customize allowed origins for scripts, styles, images, and API connect-src domains.
- Choose target format: Cloudflare Pages _headers, Nginx, or Vercel JSON.
- Copy or download the file into your deployment root and test headers after deploy.
Built-In Capabilities
- Builds complete Content-Security-Policy directives (default-src, script-src, style-src, img-src, frame-ancestors)
- One-click format switching for Cloudflare Pages _headers, Nginx add_header, and vercel.json
- Includes HSTS preload, X-Content-Type-Options: nosniff, and strict Referrer-Policy
Frequently Asked Questions
Where do I put the _headers file in Cloudflare Pages?
Place _headers at the root of your published static build output directory (e.g. dist/_headers) — Cloudflare Pages applies it automatically.
Why set frame-ancestors alongside X-Frame-Options?
frame-ancestors in CSP supersedes X-Frame-Options in modern browsers while X-Frame-Options covers legacy clients against clickjacking.
When should I avoid unsafe-inline in script-src?
Avoid unsafe-inline in script-src whenever possible; prefer external module scripts or cryptographic nonces to stop XSS.
Does HSTS preload require subdomains to support HTTPS?
Yes — only enable includeSubDomains and preload once every subdomain serves valid HTTPS.