IIS (Internet Information Services) · Advanced IIS

TLS Hardening, HTTP/2 and HSTS

Having a certificate is step one. Step two is making sure only modern, safe protocols are used.

Advanced 5 min Lesson 35 of 45Covers IIS 10 on Windows Server 2019/2022/2025 and Windows 10/11.
0/45 in IIS
On this page · 5 min · Advanced

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)#

PowerShellDisable TLS 1.0 and 1.1 server-wide (then reboot) Illustrative
$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
Expected output
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#

  1. SCHANNEL keys control protocols for every HTTPS service on the server.
  2. Enabled = 0 and DisabledByDefault = 1 turn the protocol off for the server side.
  3. The hsts element of the site turns on the header and the redirect.
  4. 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#

Disabling TLS 1.2 by accident

Then nothing can connect. Change only 1.0 and 1.1, and test on one server first.

HSTS preload too early

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
Text Illustrative
Strict-Transport-Security: max-age=31536000

Mini quiz#

TLS Hardening, HTTP/2 and HSTS quizMultiple choice Question 1 of 1

Which TLS versions should a public site accept today?

Score so far: 0/0

Want more? Practise all IIS MCQs · IIS interview questions

My notes#

Saved in this browser.

Progress is saved in this browser. Sign in to sync.