TLS Hardening, HTTP/2 and HSTS
Having a certificate is step one. Step two is making sure only modern, safe protocols are used.
On this page · 5 min · Advanced
On this page
- Learning objectives
- Explanation
- Step-by-step screens
- Code example
- Step by step
- Real-world use
- Common mistakes
- Best practices
- Remember this
- Practice exercise
- Mini quiz
- Related topics
- My notes
- Reading time
- 5 min
- Difficulty
- Advanced
- Updated
- Nov 26, 2026
Related tutorials
Interview questions
Learning objectives#
- Disable legacy TLS for a site
- Use HTTP/2 and TLS 1.3
- Turn on HSTS in IIS
- Test the configuration
Explanation#
TLS 1.0 and 1.1 are obsolete. On Windows Server 2022 and later, the https binding has a Disable Legacy TLS option for that site; server-wide they are switched off in the SCHANNEL registry keys (or with the free IIS Crypto tool). Windows Server 2022 supports TLS 1.3 — keep it enabled.
HTTP/2 is on by default for HTTPS bindings in IIS 10; leave “Disable HTTP/2” unticked. It speeds up pages with many files.
HSTS tells browsers to use HTTPS only. IIS 10 (version 1709 and later) has it built in: select the site → Actions → HSTS… → Enable, Max-Age 31536000, and Redirect Http to Https.
Check the result with an external SSL test (for example SSL Labs): aim for grade A, no TLS 1.0/1.1, and HSTS present. Older clients (very old Android, Windows 7 without updates) may stop connecting — that is the intended trade-off.
Step-by-step screens#
Drawings of IIS Manager in IIS 10 (Windows Server 2019/2022, Windows 10/11). The red numbers match the numbered actions under each picture; names on your computer will differ.
Loading pictures…
Code example: Disable TLS 1.0 and 1.1 server-wide (then reboot)#
$base = 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols'
foreach ($p in 'TLS 1.0', 'TLS 1.1') {
New-Item "$base\$p\Server" -Force | Out-Null
New-ItemProperty "$base\$p\Server" -Name Enabled -Value 0 -PropertyType DWord -Force | Out-Null
New-ItemProperty "$base\$p\Server" -Name DisabledByDefault -Value 1 -PropertyType DWord -Force | Out-Null
}
# HSTS for the Shop site (IIS 10 1709+)
Import-Module IISAdministration
$site = Get-IISConfigSection -SectionPath 'system.applicationHost/sites' | Get-IISConfigCollection | Get-IISConfigCollectionElement -ConfigAttribute @{ name = 'Shop' }
$hsts = Get-IISConfigElement -ConfigElement $site -ChildElementName 'hsts'
Set-IISConfigAttributeValue -ConfigElement $hsts -AttributeName enabled -AttributeValue $true
Set-IISConfigAttributeValue -ConfigElement $hsts -AttributeName max-age -AttributeValue 31536000
Set-IISConfigAttributeValue -ConfigElement $hsts -AttributeName redirectHttpToHttps -AttributeValue $true
Restart-Computer
After the reboot, connections with TLS 1.0/1.1 fail, TLS 1.2/1.3 work, and responses include Strict-Transport-Security: max-age=31536000.
This example is illustrative. Copy or download it and run it in your own environment; the expected output is shown above.
Step-by-step explanation#
- SCHANNEL keys control protocols for every HTTPS service on the server.
- Enabled = 0 and DisabledByDefault = 1 turn the protocol off for the server side.
- The hsts element of the site turns on the header and the redirect.
- Protocol changes need a reboot.
Real-world use case#
A payment provider’s audit required TLS 1.2+ and HSTS. The admin applied the settings, rebooted at night and passed the external scan with grade A.
Common mistakes#
Then nothing can connect. Change only 1.0 and 1.1, and test on one server first.
Preloading is hard to undo. Make sure every subdomain works on HTTPS before using includeSubDomains or preload.
Best practices#
- TLS 1.2 and 1.3 only
- Keep HTTP/2 enabled
- HSTS with redirect
- Re-test after Windows updates
Remember this#
Legacy TLS off.
HSTS: site → HSTS…
Test with an SSL scanner.
Practice exercise#
Your task: Write the HSTS response header value for one year.
Show solution
Strict-Transport-Security: max-age=31536000
Mini quiz#
Which TLS versions should a public site accept today?
Want more? Practise all IIS MCQs · IIS interview questions
My notes#
Saved in this browser.