powershelliishttp2windows-server-2019

How to Disable HTTP/2 for Specific Sites in IIS Using PowerShell?


I'm running an IIS web server on Windows Server 2019, and I need to disable HTTP/2 for some specific sites while keeping it enabled for others.

I know that I can disable HTTP/2 globally by setting the following registry keys:

For TLS:

HKLM:\System\CurrentControlSet\Services\HTTP\Parameters
EnableHttp2Tls (DWORD) = 0

For clear text (non-TLS):

HKLM:\System\CurrentControlSet\Services\HTTP\Parameters
EnableHttp2Cleartext (DWORD) = 0

However, this approach disables HTTP/2 for all sites on the server. Is there a way to disable HTTP/2 for specific sites or applications in IIS using PowerShell or any other method?

I've looked into the IIS configuration settings but couldn't find an option to control HTTP/2 at the site level.

Any guidance or scripts to achieve this would be greatly appreciated.

Environment:

Windows Server 2019 IIS 10

What I've Tried:

Modifying the global registry keys (disables HTTP/2 server-wide) Searching through IIS site-level settings via PowerShell


Solution

  • By setting -SslFlag property in command, you can achieve your needs, something like below:

    New-IISSiteBinding -Name "mySite" -BindingInformation "*:443:" -CertificateThumbPrint "xxxx" -CertStoreLocation "your:\cert\path" -Protocol https -SslFlag "DisableHTTP2"
    

    Simply refer to this doc: New-IISSiteBinding - SslFlag property.