Build a Strict-Transport-Security header with max-age, subdomains, and preload options.
The frame below runs the same code as this page, in the reader's own browser. Nothing is sent to us, and nothing is sent to you.
Pick a dark background and the text and panels follow it, so the frame stays readable on a dark page.
max-age, includeSubDomains, and preload become a Strict-Transport-Security response header, with max-age measured in seconds. Browsers honor the header only when received over a secure connection.
Max age: 31536000 Include sub domains: true Preload: true
# HTTP Strict Transport Security (HSTS)
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
# Duration: 1 year(s)
# Preload: Eligible for browser HSTS preload list
# Apache (.htaccess)
Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
# Nginx
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;
# Express.js
app.use((req, res, next) => {
res.setHeader('Strict-Transport-Security', 'max-age=31536000; includeSubDomains; preload');
next();
});
# To submit to the HSTS preload list:
# https://hstspreload.org/
# Requirements: max-age >= 31536000, includeSubDomains, preload
Web servers, security audits, and platform TLS configuration build HSTS.