'How to disable HTTP1.1 and only use HTTP/2 in Windows Server 2016 and IIS 10?

Traffic to my site is using HTTP1.1, and I want to force the server to only use HTTP/2.

I'm running Windows Server 2016 and IIS 10. I've tried adding

  • HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\HTTP\Parameters
    • EnableHttp2Tls: DWORD = 1
    • EnableHttp2ClearText: DWORD = 1

but it is still serving HTTP1.1.

I'm obviously missing something here, but I'm not exactly sure what. Is what I'm asking for even possible?



Solution 1:[1]

From ServerFault:

  1. Download and install URL Rewrite.

  2. Add the following to your web.config file, to the <system.webServer> section:

    web.config

    <rewrite>
        <rules>
             <rule name="RequestBlockingRule1" patternSyntax="Wildcard" stopProcessing="true">
                 <match url="*" />
                 <conditions>
                     <add input="{SERVER_PROTOCOL}" pattern="HTTP/1.0" />
                 </conditions>
                 <action type="AbortRequest" />
             </rule>
         </rules>
     </rewrite>
    

This will refuse all HTTP 1.0 requests with a HTTP 504 error code.


After installing URL Rewrite, you can also configure rewrite rules in IIS Manager:

enter image description here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ian Boyd