HSTS and HTTPS
Strict-Transport-Security asks the browser to use HTTPS on future visits. It should only be enabled when the domain and its resources work correctly over HTTPS.
- Enforce HTTPS before adding HSTS.
- Increase max-age progressively in production.
- Use includeSubDomains only when every subdomain is compatible.
CSP and allowed sources
Content-Security-Policy restricts the sources of scripts, styles, images and other resources. A strict CSP often requires an inventory before production rollout.
- Start by listing the sources the site genuinely uses.
- Avoid unsafe-inline when the architecture allows it.
- Test the policy before blocking critical resources.
Complementary headers
X-Content-Type-Options: nosniff, Referrer-Policy and Permissions-Policy reduce some implicit browser behaviours.
- Enable nosniff to restrict MIME interpretation.
- Choose a referrer policy that matches measurement needs.
- Disable unused browser features through Permissions-Policy.
Practical checklist
- HTTPS works everywhere.
- HSTS enabled carefully.
- CSP tested against real resources.
- nosniff present.
- Referrer-Policy and Permissions-Policy defined.
Continue with related resources
Conclusion
Security headers offer a strong effort-to-benefit ratio once a site is correctly configured. They still need testing because an overly strict policy can block legitimate resources.