Reading a Website's Security Headers (And What to Fix First)
Six HTTP headers do most of the browser-side security work. Here is what each one stops, and the order worth fixing them in.
Security headers are instructions your server sends telling the browser how to behave. They cost nothing to add and they close entire categories of attack. Most sites ship two of the six.
The six that matter
Strict-Transport-Security (HSTS) — tells the browser "always use HTTPS for this domain, for the next N seconds." Without it, a visitor's first request can still go out over plain HTTP and be intercepted. A sane value:
Strict-Transport-Security: max-age=31536000; includeSubDomains
Content-Security-Policy (CSP) — the big one. It lists which sources are allowed to load scripts, styles, frames and images. It is the main defence against injected scripts, and it's the header most often missing.
X-Content-Type-Options: nosniff — stops the browser from guessing a file's type. Without it, a user-uploaded file the server calls text/plain can be executed as JavaScript.
X-Frame-Options — stops your pages being embedded in someone else's iframe, which is how clickjacking works. If your CSP already sets frame-ancestors, that supersedes this one and you don't need both.
Referrer-Policy — controls how much of your URL is leaked to sites you link out to. Matters if your URLs contain tokens or IDs.
Permissions-Policy — switches off browser features you don't use: camera, microphone, geolocation.
Fix them in this order
- HTTPS everywhere, then HSTS. Everything else is decoration if traffic isn't encrypted.
- nosniff — one line, no risk of breaking anything.
- X-Frame-Options or CSP
frame-ancestors— also one line, also near-zero risk. - Referrer-Policy —
strict-origin-when-cross-originis a good default. - CSP — most work, most benefit. Deploy it in
Content-Security-Policy-Report-Onlymode first and watch what it would have blocked for a week. - Permissions-Policy — nice to have.
Check yours in a few seconds
Paste your URL into SwitchPDF Website Analyzer. It reports every one of the six with its actual value, grades the result, and knows that a CSP with frame-ancestors makes X-Frame-Options redundant — so a modern setup isn't penalised for skipping a legacy header.
It also flags a related mistake: an X-Powered-By header advertising your exact framework and version. That's free reconnaissance for anyone scanning for known vulnerabilities. Remove it.
The one that isn't a header
While you're in there, check your certificate expiry. An expired certificate takes a site fully offline for every visitor, and it happens to people who assumed auto-renewal was working. The analyzer reports days remaining.
Bottom line
Four of the six are one-line additions with essentially no risk. Do those this afternoon, then take your time with CSP. Going from an F to a B is roughly fifteen minutes of work.
Related articles
Reading a JWT Without a Library (And Why You Shouldn't Trust It)
A JWT is three Base64 chunks joined by dots. Anyone can read one — which is exactly why decoding is not verifying.
PDF Security Best Practices for Legal and Compliance Teams
A practical security checklist for handling sensitive PDFs in a small legal or compliance team.
Understanding (and Stripping) PDF Metadata for Privacy
Every PDF carries metadata: author name, software used, creation date, sometimes location data. Here's how to see and remove it.