Why the headers matter
The security headers protect visitors against clickjacking, script injection and downgrade to http, among other things. They cost little to add.
Example values
- Strict-Transport-Security: max-age=31536000; includeSubDomains
- Content-Security-Policy: default-src 'self'; frame-ancestors 'self'
- X-Content-Type-Options: nosniff
- Referrer-Policy: strict-origin-when-cross-origin
- Permissions-Policy: camera=(), microphone=(), geolocation=()
How to add them
The headers are set in the web server or in front of it: in the Apache, nginx or IIS configuration, in a WordPress plugin, or as a rule at Cloudflare or another CDN. Start with the simple headers, and test Content-Security-Policy with Content-Security-Policy-Report-Only first, so you do not stop scripts the website needs.