Security Headers & CSP Builder
Craft defense-in-depth HTTP response headers visually and export production-ready snippets that mitigate XSS, clickjacking, MIME sniffing, and protocol downgrade attacks.
// next.config.mjs
async headers() {
return [
{
source: "/(.*)",
headers: [
{ key: "Content-Security-Policy", value: "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data: https:; connect-src 'self' https://*.supabase.co; frame-ancestors 'none'; base-uri 'self'; form-action 'self'; upgrade-insecure-requests" },
{ key: "Strict-Transport-Security", value: "max-age=63072000; includeSubDomains; preload" },
{ key: "X-Frame-Options", value: "DENY" },
{ key: "X-Content-Type-Options", value: "nosniff" },
{ key: "Referrer-Policy", value: "strict-origin-when-cross-origin" },
{ key: "Permissions-Policy", value: "camera=(), microphone=(), geolocation=(), interest-cohort=()" },
],
},
];
}Practical Scenarios
When & Why to Use Security Headers & CSP Builder
Fixing Security Audit & Pentest Findings
Resolve missing CSP, HSTS, and X-Frame-Options warnings flagged by automated scanners or manual AppSec reviews.
Hardening Next.js & Cloudflare Deployments
Export copy-ready next.config.mjs headers() arrays with explicit Supabase/API connect-src allowlists.
Reverse Proxy Baseline Hardening
Generate standardized Nginx add_header blocks for staging and production web gateways.
Related Tools
Browse all toolsAuthorized Audit & Recon Commands
Parameterized defensive commands for curl header inspection, openssl TLS verification, nmap, dig DNS/DMARC, ss, and secret scanning.
JWT Inspector & Auditor
Decode JWT headers and claims while flagging alg:none, missing expirations, and weak token hygiene.
.env → Wrangler TOML / JSON / Docker
Transform .env files into Cloudflare wrangler.toml [vars], JSON objects, or Docker -e CLI flags in one click.