Module 03 · Lesson 06
Security headers that matter
A few lines of config that close whole classes of attacks.
Fix8 min
| Header | Why |
|---|---|
| Strict-Transport-Security | Forces HTTPS on return visits |
| Content-Security-Policy | Limits which scripts can run: the big defence against XSS |
| X-Content-Type-Options: nosniff | Stops browsers guessing file types |
| Referrer-Policy | Controls what URL data leaks to other sites |
| Permissions-Policy | Turns off camera, mic, location if you don't use them |
| frame-ancestors (in CSP) | Stops other sites framing yours (clickjacking) |
/* Strict-Transport-Security: max-age=31536000; includeSubDomains X-Content-Type-Options: nosniff Referrer-Policy: strict-origin-when-cross-origin Permissions-Policy: camera=(), microphone=(), geolocation=() Content-Security-Policy: default-src 'self'; frame-ancestors 'none'