Security headers
Short instructions from your web server to the browser – they protect visitors against clickjacking, injected scripts and unencrypted connections.
- Web server
- Headers in the response
- Browser enforces rules
- Visitors protected
House rules for the browser
With every page request, your web server sends invisible additional information, called headers. Some of them are like house rules for the browser: “Load this page encrypted only”, “Do not let yourself be embedded in other pages”, “Only run scripts from us”.
What they protect against
- Enforce encryption (HSTS): the browser remembers that your page may only be loaded via HTTPS.
- Prevent embedding: nobody can lay your page invisibly over another one and trick visitors into unwanted clicks (clickjacking).
- Content rules (CSP): the browser only runs scripts from permitted sources. An injected script goes nowhere.
- Reveal less: without version details in the header, an attacker has to guess longer which software you use.
Security headers are like the “Access with badge only” sign on the door. They do not replace a lock, but they stop many simple tricks.
What you can do
Most headers can be set with a few lines in the server configuration or the hosting panel. Care is needed with the content rule (CSP): first only monitor, then enforce – otherwise parts of the website may stop working.
In short
- Security headers are instructions to the browser.
- HSTS and CSP are the most important; introduce CSP in monitoring mode first.
- Hiding version details makes it harder to search for gaps.
- A few lines of configuration are usually enough.