Skip to content

Security Headers (CSP, HSTS & Co.)

Glossary

Security headers are instructions your server sends to the browser with every page: connect only over encryption (HSTS), run only scripts from allowed sources (Content Security Policy), refuse to be embedded in other sites (clickjacking protection). They do not close a gap in the code, but they limit what a gap can do. Missing headers are rarely acute, but they are one of the most common oversights in AI-built apps.

The most important ones at a glance: Strict-Transport-Security (HSTS) tells the browser to call your site over https only from now on. Content-Security-Policy (CSP) defines which sources scripts may run from. X-Content-Type-Options: nosniff stops the browser from guessing content types. X-Frame-Options or the CSP directive frame-ancestors protect against being embedded in other sites. Referrer-Policy governs which parts of the address go to other sites, Permissions-Policy restricts camera, microphone and location.

Why the CSP matters especially for AI-built apps: there, user input often lands in the HTML unfiltered. Without a CSP the browser runs every script that gets into the page that way. With a strict policy the gap in the code still exists, but the foreign code does not run. HSTS closes a different gap: without the header the very first request often still goes over unencrypted http, and exactly that moment can be intercepted on untrusted networks.

You set the headers in your hosting configuration or framework, a few lines each. Run the CSP in report-only mode first so nothing breaks, then tighten it step by step; start HSTS with a short lifetime and raise it once everything stays reachable over https. The free decivo Scan checks all the headers above from the outside and says what to do about each missing one.

Frequently asked questions

What are security headers?
Which security headers should a web app set?
Is a missing security header a vulnerability?
How do I check my site's security headers?

Ready for production-ready software?

Bring your project to a first call — we'll assess it honestly and recommend the right next step.

Book a call

30 minutes, free. You talk to us directly.