HTTPREF
← Back to headers

HTTP Header

Strict-Transport-Security

Security

Instructs browsers to only access the site over HTTPS for a specified period.

HTTP header reference, syntax, examples, and developer usage.

What is the Strict-Transport-Security header?

The Strict-Transport-Security HTTP header is used to transmit metadata between a client and server as part of HTTP requests or responses.

HTTP headers define how content should be interpreted, cached, authenticated, secured, or processed by browsers and APIs.

Direction

This header may appear in both HTTP requests and responses.

Syntax

Strict-Transport-Security: max-age=31536000; includeSubDomains

Example

Strict-Transport-Security: max-age=31536000; includeSubDomains

Common use cases

  • HTTPS enforcement
  • Improved transport security
  • Security hardening

Common mistakes

  • Using the header in the wrong request or response context
  • Sending invalid header values
  • Incorrect header syntax
  • Assuming the header automatically changes server behaviour

Related headers