HSTS

HSTS (Strict-Transport-Security) Header Generator & Preload Validator

IETF RFC 6797

Generate HTTP Strict-Transport-Security (HSTS) headers with max-age calculator, includeSubDomains, and Chrome preload readiness check.

Presets:
Effective Duration:2 years (730 days / 63,072,000s)
includeSubDomainsRFC 6797 §6.1.2

Enforces HSTS on all current and future subdomains (e.g. *.example.com). Mandatory for Chrome Preload.

preloadChromium Spec

Grants consent to be hardcoded in Chrome, Edge, Firefox, and Safari source code. Requires max-age >= 31536000 and includeSubDomains.

Server "always" Flag (Nginx / Apache)Recommended

Ensures the header is sent on all HTTP responses, including 404, 500, and 502 error pages.

# ====================================================================
# Nginx Configuration: Strict-Transport-Security (HSTS)
# Server Block: https://example.com
# ====================================================================
server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name example.com *.example.com;

    # SSL Certificate Paths
    ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;

    # HSTS Security Header
    # Note: 'always' ensures the header is sent even on 4xx/5xx error responses
    add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" always;

    # Recommended Complementary Security Headers
    add_header X-Content-Type-Options "nosniff" always;
    add_header X-Frame-Options "DENY" always;
    add_header Referrer-Policy "strict-origin-when-cross-origin" always;

    location / {
        proxy_pass http://127.0.0.1:3000;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto https;
    }
}

# Redirect HTTP (Port 80) to HTTPS (Port 443)
# RFC 6797 §7.2: DO NOT send Strict-Transport-Security over insecure HTTP!
server {
    listen 80;
    listen [::]:80;
    server_name example.com *.example.com;
    return 301 https://$host$request_uri;
}
Active Directives
3 / 3 Active
Preload Readiness
100% (Ready)
Effective Duration
2 years

100% Client-Side Evaluation

Zero server uploads. Your domain names, security policies, and server configurations are evaluated strictly inside your browser sandbox.

RFC 6797 & Chrome Preload Spec

Fully compliant with IETF RFC 6797 specifications and official Chromium HSTS Preload submission requirements for Chrome, Firefox, Safari, and Edge.

Multi-Web Server Synthesis

Instant generation of battle-tested configurations for Nginx, Apache httpd, Caddy, Cloudflare Workers, Next.js, and HAProxy with always-send flags.

Technical Reference & Architecture Guide

HSTS (Strict-Transport-Security) Header Generator & Preload Validator — Reference Guide

Generate RFC 6797 HTTP Strict-Transport-Security (HSTS) headers with max-age calculations, includeSubDomains directives, and Chrome HSTS preload list eligibility verification.

Key Parameters & Controls

max-ageInteger (seconds)

Specifies the time window in seconds that the user agent should automatically upgrade all requests to HTTPS and refuse insecure connections.

Default: 63072000 (2 years)
includeSubDomainsBoolean flag

Applies the strict transport security policy to all subdomains of the current host domain, preventing downgrade attacks on existing or future sub-services.

Default: true
preloadBoolean flag

Authorizes automated web crawlers and browser vendors to submit and hardcode your domain into the global Chromium and WebKit HSTS Preload list.

Default: true
Web Server / PlatformEnum (Nginx | Apache | Cloudflare | Caddy | Vercel | IIS)

Target web server or reverse proxy configuration syntax for deploying the Strict-Transport-Security HTTP response header.

Default: Nginx

Pro Tips & Best Practices

Never enable 2-year max-age

Never enable 2-year max-age with includeSubDomains immediately. Begin with 5 minutes (max-age=300), progress to 1 week (max-age=604800), and verify every internal, mail, and legacy subdomain over HTTPS before committing to max-age=63072000.

Per RFC 6797 Section 7.2

Per RFC 6797 Section 7.2, browsers must ignore Strict-Transport-Security headers delivered over plaintext HTTP. Placing HSTS on HTTP port 80 redirects can leak security tokens and triggers security scanner warnings.

Submitting to hstspreload.org bakes your

Submitting to hstspreload.org bakes your domain directly into Chrome, Firefox, Safari, and Edge binaries. Removing a domain requires a vendor release cycle that typically takes 2 to 6 months to reach all active users worldwide.

Common Gotchas & Troubleshooting

Subdomains become inaccessible with SSL certificate or connection refusal errors

Enabling includeSubDomains forces all existing and newly created subdomains to load over HTTPS. If any subdomain lacks a valid TLS certificate, immediately provision a wildcard or dedicated SSL certificate, or temporarily set max-age=0 on the parent domain to reset client HSTS caches.

Domain rejected by hstspreload.org during submission validation

Ensure your apex domain serves a valid TLS certificate, redirects port 80 to 443 with HTTPS redirect, responds with max-age >= 31536000 seconds, and includes both the includeSubDomains and preload directives on the initial HTTPS response.

Frequently Asked Questions

What is HTTP Strict Transport Security (HSTS) and what attacks does it prevent?▼

HSTS is an IETF standard security header defined in RFC 6797. When declared, it instructs web browsers to automatically rewrite all plaintext 'http://' requests to 'https://' locally before transmitting data over the wire. This eliminates man-in-the-middle (MITM) downgrade attacks, prevents SSL stripping via malicious Wi-Fi hotspots, and strictly blocks end-users from bypassing SSL certificate warnings.

What are the mandatory requirements for Chrome HSTS Preload list inclusion?▼

To qualify for hstspreload.org, your domain must: 1) serve a valid TLS certificate, 2) redirect HTTP port 80 to HTTPS on the same host, 3) serve all subdomains over HTTPS, 4) return an HSTS header on the base domain with a max-age of at least 31536000 (1 year), and 5) explicitly include both the 'includeSubDomains' and 'preload' directives.

Can an HSTS policy be revoked or modified if a critical configuration mistake occurs?▼

For non-preloaded domains, you can deploy 'Strict-Transport-Security: max-age=0' over HTTPS, which instructs visiting browsers to expire and clear the cached HSTS policy immediately upon their next HTTPS visit. However, if your domain has been accepted into the browser preload list, removing it requires submitting a removal request to hstspreload.org and waiting for browser binary updates to deploy globally.

Why do browsers disallow users from clicking through SSL warnings when HSTS is active?▼

Under regular HTTPS, browsers provide a 'Proceed to site (unsafe)' override button when an invalid or expired certificate is detected. Under HSTS, RFC 6797 mandates that user agents must terminate the connection without providing any user bypass option, ensuring malicious attackers cannot use fake self-signed certificates or proxy interception to compromise sensitive data.

Related Tools & Utilities

All Tools →