Security Headers Generator - CSP & Header Config

Configure Content-Security-Policy and common security headers visually, then generate HTTP header, Nginx, Apache and HTML meta output. Everything is built locally in your browser.

Content-Security-Policy

Other security headers

Permissions-Policy

Generated Config

Content-Security-Policy: default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self'; connect-src 'self'; media-src 'self'; object-src 'none'; frame-src 'none'; frame-ancestors 'self'; base-uri 'self'; form-action 'self'; worker-src 'self'; manifest-src 'self'; upgrade-insecure-requests; block-all-mixed-content
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Frame-Options: SAMEORIGIN
X-Content-Type-Options: nosniff
Referrer-Policy: strict-origin-when-cross-origin
Permissions-Policy: camera=(), microphone=(), geolocation=()
Cross-Origin-Opener-Policy: same-origin
Cross-Origin-Resource-Policy: same-origin

The config is generated locally and no site information is uploaded. Test it in staging before production to avoid blocking legitimate resources.

About This Tool

Security response headers are one of the cheapest and most effective layers of defense. This generator turns Content-Security-Policy and other common headers into a visual panel so you can produce production-ready output.

Export as HTTP headers, Nginx, Apache or HTML meta, starting from strict, recommended or relaxed presets. The config is generated locally and your domains and policies are never uploaded.

Key Features

Visual CSP editing

Edit default-src, script-src, connect-src and more line by line; leave a field empty to omit it.

Common headers included

HSTS, X-Frame-Options, Referrer-Policy, Permissions-Policy and cross-origin policies in one place.

Three presets

Switch between strict, recommended and relaxed baselines, then fine-tune.

Four output formats

Generate header, Nginx, Apache and HTML meta syntax for different deployments.

Risk warnings

Flags unsafe-inline, unsafe-eval, wildcards and an object-src that is not locked down.

When to Use It

Pre-launch security check

Add baseline security headers before going live to reduce XSS, clickjacking and downgrade risks.

Harden an existing site

Start from the recommended profile and tighten sources gradually while watching reports.

Hand off to ops

Copy the Nginx or Apache snippet directly and avoid manual transcription errors.

How to Use It

  1. 1Choose the strict, recommended or relaxed preset.
  2. 2Adjust each CSP directive to match your real sources.
  3. 3Configure HSTS, Referrer-Policy, Permissions-Policy and related headers.
  4. 4Pick an output format and copy it into your server or template.

Frequently Asked Questions

Will CSP block legitimate resources?

It can. Enable it in staging first and watch the browser console to confirm scripts, styles, fonts and API origins are all allowed.

Can HTML meta set every header?

No. Meta is mainly useful for CSP; HSTS, X-Frame-Options and similar headers must come from the server response.

What is the difference between strict and recommended?

Strict denies everything by default and only allows same-origin scripts and styles. Recommended permits inline styles and data: images that many sites rely on.

Is the config uploaded?

No, everything is generated locally in your browser.

Other Tools

CodeSwordsman

100+ technical tools with browser-local processing — your data never leaves your device. Official Microsoft Store desktop apps: free, ad-free, offline.

Completely Free

© 2026 CodeSwordsman All Rights Reserved

Service Terms | Privacy Policy | Help | Version Updates | About Us

This website uses cookies to ensure you get the best experience on our website. Privacy Policy.