Back to HTTP Headers
Response

HTTP Strict-Transport-Security (HSTS) Header

Tells the browser to only communicate with the server over HTTPS, never HTTP. Protects against protocol downgrade attacks.

Purpose

Enforces HTTPS-only communication, preventing man-in-the-middle attacks and protocol downgrade attempts.

Strict-Transport-Security: max-age=<seconds> Strict-Transport-Security: max-age=<seconds>; includeSubDomains Strict-Transport-Security: max-age=<seconds>; preload

Code Examples

See how to use the Strict-Transport-Security (HSTS) header in different tools and languages.

curl -I https://api.example.com
# Strict-Transport-Security: max-age=31536000; includeSubDomains; preload

Related Headers

Test Your APIs

strict-transport-security headerhttp strict-transport-securityhttp headers guide