HTTP response headers are instructions a server sends with a response. Security headers can require HTTPS on later visits, check script and stylesheet types, limit referrer information, and restrict which pages can frame your site. Their effect depends on the values you send and the browser applying them.
Strict-Transport-Security (HSTS)
After receiving HSTS over HTTPS, a browser remembers the policy for the max-age you specify and upgrades later HTTP visits automatically. This response header does not protect a first HTTP visit before the browser knows the policy; an inherited or preloaded HSTS policy can cover that case.
Strict-Transport-Security: max-age=31536000; includeSubDomainsX-Content-Type-Options
For script and stylesheet requests, nosniff tells the browser to check the declared Content-Type and block unsuitable MIME types. It is one response-header safeguard, not a substitute for validating uploaded files or serving them safely.
X-Content-Type-Options: nosniffReferrer-Policy
The Referer header tells the destination which page a visitor came from, including any path or query string. A sensible policy sends the origin cross-site but never the full URL, so private paths and tokens don't leak.
Referrer-Policy: strict-origin-when-cross-originFrame protection
Clickjacking works by loading your site inside an invisible frame on an attacker's page and tricking users into clicking. Deny framing with a Content-Security-Policy frame-ancestors directive (the modern approach), keeping X-Frame-Options as a fallback for older browsers.
Content-Security-Policy: frame-ancestors 'none'
X-Frame-Options: DENYPermissions-Policy
Permissions-Policy lets you switch off powerful browser features your site doesn't use (camera, microphone, geolocation) so a compromised script or embedded frame can't quietly request them.
Permissions-Policy: geolocation=(), microphone=(), camera=()How to fix it
Set these on the server or edge, not per page. On Cloudflare you can add them with a Transform Rule or in a Worker; on nginx use add_header; on Apache use Header set. Add one at a time, deploy, and re-scan to confirm each is present and well-formed.
Glossary
- Header
- A name/value line the server sends with a response, carrying metadata the browser acts on before rendering.
- max-age
- How long (in seconds) the browser should remember a directive such as HSTS.
- Clickjacking
- Tricking a user into clicking something different from what they perceive, usually via a hidden frame.