Security headers explained for vibe coders

The six HTTP security headers that matter most, what each one does and safe starting values.

Short answer: security headers are instructions your server sends with every page that tell the browser to block common attacks. Six of them do most of the work.

HeaderWhat it doesSafe starting value
Strict-Transport-SecurityForces HTTPS on future visitsmax-age=31536000; includeSubDomains
Content-Security-PolicyLimits where scripts, styles and images can load fromStart with default-src 'self' and add the domains you use
X-Content-Type-OptionsStops the browser from guessing file typesnosniff
Referrer-PolicyLimits what URL details are sent to other sitesstrict-origin-when-cross-origin
Permissions-PolicyTurns off browser features you don't usecamera=(), microphone=(), geolocation=()
Frame protectionStops other sites from embedding yours in a frameframe-ancestors 'self' in your CSP, or X-Frame-Options: DENY

How to add them

Where you set headers depends on your hosting: a config file such as vercel.json or netlify.toml, your framework's middleware, or your CDN's settings. Ask your AI coding tool: "Add these security headers to every response," then paste the table above.

Test it

Run our free security header check before and after. Content-Security-Policy is the one most likely to break something, so add it last and test your app's pages after each change.

Headers are one layer

Good headers don't fix open database rules or leaked keys. Use our 10-minute checklist for the rest.

Questions & answers