Hacking via HTTP traffic interception is one of the simplest attacks: an attacker gets between client and server, downgrades the protocol to HTTP and intercepts cookies or injects malicious code. According to SSL Labs, about 30% of sites are still not protected from SSL stripping. Every day tens of thousands of users lose confidential data due to unsecured HTTP connections — the average damage from such an incident exceeds 500,000 RUB, and for large e-commerce can reach several million. HSTS eliminates this problem with a single header. In 15 minutes you close a vulnerability that costs your users their privacy. We don't just set the header — we configure HSTS taking into account your infrastructure, subdomains, and transition plan to the preload list. After enabling HSTS, the browser will always request HTTPS, without an extra redirect, reducing load time by 300-500 ms. HSTS is 10 times more reliable than a simple redirect — it blocks the attack before the connection is established. Implementing preload gives protection on first click even for new users. Caching the HSTS header in the browser for 365 days ensures that even if an attacker intercepts the first request, they cannot downgrade the protocol — the browser already knows to use HTTPS. Contact us to get a consultation and an accurate deployment plan.
How HSTS Works
The server sends the header:
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload After the first visit, the browser caches this directive for 365 days. All subsequent requests to the domain and its subdomains are automatically upgraded to HTTPS before being sent over the network — without a 301 redirect, without a round-trip to the server. This eliminates man-in-the-middle attacks during the transition phase.
Why Enable HSTS Early?
The sooner you enable HSTS, the sooner users get protection. But activating with max-age=31536000 on a production site immediately is risky. If it later turns out that the SSL certificate does not cover some subdomain, users will be unable to access it for 365 days. Therefore, we apply a phased strategy.
Typical Deployment Plan:
| Stage | max-age | Duration | Risk |
|---|---|---|---|
| 1. Test | 300 (5 min) | 1 week | Minimal — quick rollback possible |
| 2. Assessment | 2592000 (30 days) | 2 weeks | Low — subdomains under control |
| 3. Final | 31536000 (1 year) + includeSubDomains | Permanent | Near zero — all subdomains verified |
| 4. Preload | Preload directive | Submit request | Long rollback, stable HTTPS required |
This scheme avoids subdomain lockout and takes about a month to complete all stages.
Step-by-Step HSTS Deployment
- Start with max-age=300 on a test subdomain to confirm correct operation.
- After a week without errors, increase max-age to 30 days.
- Verify all subdomains have HTTPS. Add includeSubDomains.
- After two weeks, switch to max-age=31536000 and submit an application to the Preload List.
This methodology minimizes the risk of blocking.
Configuration on Nginx
server { listen 443 ssl http2; server_name example.com www.example.com; add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always; # Rest of configuration... } The always parameter is critical — without it, the header is not sent on error responses (4xx, 5xx). If you use Cloudflare, you can configure HSTS through the control panel, but then you lose control over the preload directive.
Configuration on Apache
<VirtualHost *:443> Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" </VirtualHost> The mod_headers module must be enabled: a2enmod headers.
What's Included in Turnkey HSTS Setup
We prepare a full set of documents and configurations:
- Verification of all subdomains for HTTPS support (including
www,cdn,api,mail) - Header configuration for Nginx or Apache tailored to your structure
- Step-by-step plan for increasing
max-agewith monitoring control - Assistance with submitting an application to the HSTS Preload List
- Testing via HSTS Preload Check and a vulnerability report
HSTS Preload List
The application is submitted at hstspreload.org. After inclusion in the list, Chrome, Firefox, and Safari know about your HSTS requirement even before the user's first visit — this provides protection "from the first click." Removing a domain from the list is a lengthy procedure (several months), so we recommend enabling preload only after full confidence in your HTTPS infrastructure.
Preload Requirements:
-
max-ageat least 31536000 -
includeSubDomainsdirective -
preloaddirective - All subdomains must support HTTPS
Common mistake: forgetting to switch certificates on all subdomains
Before enabling preload, verify that every subdomain has a valid SSL certificate. Otherwise, requests to it will be blocked by the browser without any error page.Comparison of HSTS and 301 Redirect
| Parameter | HSTS | 301 Redirect |
|---|---|---|
| Protection from SSL stripping | Yes (blocks HTTP at browser level) | No (redirect can be intercepted) |
| Latency | Zero (no round-trip) | One extra request (300-500 ms) |
| Caching | Configurable (max-age) | No client caching |
| Server requirements | Only header | HTTPS support and redirect configuration |
| Risk of erroneous blocking | High if misconfigured | Low (can be rolled back) |
HSTS is far more reliable in terms of security and faster for the user. Savings on redirects and SSL load can reach up to 30% of traffic costs. For a site with 50,000 unique visitors per month, this means savings of up to 30,000 RUB per year.
How Long Does Setup Take
Basic configuration of a single header — 1–2 hours including testing. Full cycle to preload status — 2–4 weeks, with phased increase of max-age and monitoring. Exact timelines are calculated after an audit of your infrastructure — contact us for an assessment.
Why Choose Us
We have been doing web security for over 8 years and have configured HSTS for 50+ projects, including e-commerce sites with hundreds of subdomains. We guarantee correct operation on all popular CMS and frameworks. Order an HSTS audit now — get a deployment plan and free consultation.







