Website security
Website Security Headers Explained
By PixelPrivate Security Team · Published · Updated · 7 min read
Short answer: Security headers are instructions your web server sends with each page that turn on browser protections. The five to start with are Strict-Transport-Security, Content-Security-Policy, X-Content-Type-Options, Referrer-Policy and Permissions-Policy.
Strict-Transport-Security (HSTS)
Forces browsers to use HTTPS for your site. Start with a short max-age and extend once nothing breaks.
Strict-Transport-Security: max-age=31536000; includeSubDomainsContent-Security-Policy (CSP)
Controls where scripts, styles and other resources may load from. It is the most powerful and the easiest to get wrong. Begin with the report-only variant and review reports before enforcing.
Content-Security-Policy-Report-Only: default-src 'self'; img-src 'self' https:X-Content-Type-Options
Stops browsers from guessing a file’s type, which blocks some content-sniffing attacks.
X-Content-Type-Options: nosniffReferrer-Policy
Limits how much of your page address is shared with other sites when visitors click out.
Referrer-Policy: strict-origin-when-cross-originPermissions-Policy
Disables browser features you do not use, such as the camera or microphone, for your pages.
Permissions-Policy: camera=(), microphone=(), geolocation=()Clickjacking protection
Prevent other sites framing your pages with CSP frame-ancestors (preferred) or X-Frame-Options.
Content-Security-Policy: frame-ancestors 'self'Where to add them
Add headers where your site is served: hosting dashboard, CDN rules (for example Cloudflare Transform Rules), or web-server config. If a CDN sits in front, check the headers visitors actually receive.
Checklist
- ☐ HSTS added
- ☐ CSP in report-only, then enforced
- ☐ nosniff added
- ☐ Referrer-Policy added
- ☐ Permissions-Policy added
- ☐ frame-ancestors set
- ☐ Verified with a header checker
Methodology
Values below follow the OWASP Secure Headers Project and MDN documentation. Always test changes on a staging copy.