{"data":{"slug":"github-thedaviddias-front-end-checklist-skills-hsts-6ba4824feca0","title":"Implement HTTP Strict Transport Security (HSTS)","summary":"Enforce HTTPS communication by setting the Strict-Transport-Security header on all HTTPS responses with a minimum max-age of 31536000 and includeSubDomains directive.","url":"https:\/\/skillshunter.net\/skills\/github-thedaviddias-front-end-checklist-skills-hsts-6ba4824feca0","json_url":"https:\/\/skillshunter.net\/api\/public\/v1\/skills\/github-thedaviddias-front-end-checklist-skills-hsts-6ba4824feca0","markdown_url":"https:\/\/skillshunter.net\/skills\/github-thedaviddias-front-end-checklist-skills-hsts-6ba4824feca0.md","download_url":"https:\/\/skillshunter.net\/skills\/github-thedaviddias-front-end-checklist-skills-hsts-6ba4824feca0\/download","category":{"slug":"software-development","name":"Software & Development"},"editor_note":"Ensure the HSTS header is only sent over HTTPS and not over plain HTTP. Test the configuration thoroughly before adding the preload directive, as it is difficult to remove once submitted.","instructions":"---\nname: hsts\ndescription: \"Use when reviewing HTTP response headers on any site that serves content over HTTPS.\"\nmetadata:\n  category: security\n  priority: high\n  difficulty: intermediate\n  estimatedTime: \"15\"\n  source: frontendchecklist.io\n  url: https:\/\/frontendchecklist.io\/rules\/security\/hsts\n---\n\n# Set an HSTS header\n\nWithout HSTS, an attacker on the same network can intercept the first HTTP request and strip TLS (SSL stripping), silently downgrading the connection before the browser ever sees a redirect.\n\n## Quick Reference\n\n- Set `Strict-Transport-Security: max-age=31536000; includeSubDomains` on all HTTPS responses\n- Use `max-age=31536000` (1 year) minimum; HSTS preloading requires at least 1 year\n- Add `includeSubDomains` to protect all subdomains from downgrade attacks\n- Add `preload` only after testing \u2014 it is difficult to reverse and takes weeks to propagate\n- Never send the HSTS header over plain HTTP \u2014 only over HTTPS\n\n## Check\n\nCheck whether the server sends a Strict-Transport-Security header on all HTTPS responses, and verify the max-age, includeSubDomains, and preload directives are appropriate.\n\n## Fix\n\nAdd a Strict-Transport-Security header with max-age=31536000 and includeSubDomains to all HTTPS responses. Configure your web server or CDN to send this header, and validate it with curl or securityheaders.com.\n\n## Explain\n\nExplain what HTTP Strict Transport Security (HSTS) is, how it prevents SSL stripping attacks, what the max-age and includeSubDomains directives do, and why the preload directive requires caution.\n\n## Code Review\n\nReview server config, headers, forms, and integration points related to Set an HSTS header. Flag exact responses, cookies, or browser behaviors that violate the rule, and verify them against the effective production-like response.\n\n---\n\nFor full implementation details, code examples, and framework-specific guidance,\nsee `references\/rule.md`.\n\nRule page: https:\/\/frontendchecklist.io\/rules\/security\/hsts\n","use_cases":["Prevent SSL stripping attacks by enforcing HTTPS connections.","Protect subdomains from downgrade attacks using HSTS headers.","Ensure all HTTPS responses include the Strict-Transport-Security header with max-age=31536000 and includeSubDomains."],"limitations":[],"compatibility":[],"setup_tip":null,"sample_input":null,"sample_output":null,"source_url":"https:\/\/github.com\/thedaviddias\/Front-End-Checklist\/blob\/e8d14d049010e2ce25afcd5e8609dfcbbe63e47e\/skills\/hsts\/SKILL.md","source_commit":"e8d14d049010e2ce25afcd5e8609dfcbbe63e47e","license":null,"version":null,"listing_approved_at":"2026-11-23","created_at":"2026-11-22T16:23:56.000000Z","updated_at":"2026-11-23T04:55:09.000000Z","seo_title":"Implement HTTP Strict Transport Security (HSTS) for HTTPS","seo_description":"Secure your website by enforcing HTTPS with HSTS headers. Learn how to set and validate HSTS headers for all HTTPS responses.","seo_keywords":["HSTS header implementation","Enforce HTTPS with HSTS","Secure HTTPS connections","Prevent SSL stripping attacks","HSTS header configuration"]}}