<h2><aname="implementation"id="implementation">HTTP/2 in Apache httpd</a></h2>
<p>The HTTP/2 protocol is implemented by its own httpd module, aptly named
<ahref="../mod/mod_http2.html">mod_http2</a>. It implements the complete set
<codeclass="module"><ahref="../mod/mod_http2.html">mod_http2</a></code>. It implements the complete set
of features described by RFC 7540 and supports HTTP/2 over cleartext (http:), as
well as secure (https:) connections. The cleartext variant is named '<code>h2c</code>',
the secure one '<code>h2</code>'. For <code>h2c</code> it allows the <em>direct</em>
@@ -84,8 +86,8 @@
<divclass="section">
<h2><aname="building"id="building">Build httpd with HTTP/2 support</a></h2>
<p><ahref="../mod/mod_http2.html">mod_http2</a> uses the library of <ahref="https://nghttp2.org">nghttp2</a>
as its implementation base. In order to build <code>mod_http2</code> you need at least version 1.2.1 of
<p><codeclass="module"><ahref="../mod/mod_http2.html">mod_http2</a></code> uses the library of <ahref="https://nghttp2.org">nghttp2</a>
as its implementation base. In order to build <codeclass="module"><ahref="../mod/mod_http2.html">mod_http2</a></code> you need at least version 1.2.1 of
<code>libnghttp2</code> installed on your system.</p>
<p>When you <code>./configure</code> you Apache httpd source tree, you need to give it
'<code>--enable-http2</code>' as additional argument to trigger the build of the module.
@@ -94,7 +96,7 @@
to <code>configure</code>.</p>
<p>While that should do the trick for most, they are people who might prefer a statically
linked <code>nghttp2</code> in this module. For those, the option <code>--enable-nghttp2-staticlib-deps</code>
exists. It works quite similar to how one statically links openssl to mod_ssl.</p>
exists. It works quite similar to how one statically links openssl to <codeclass="module"><ahref="../mod/mod_ssl.html">mod_ssl</a></code>.</p>
<p>Speaking of SSL, you need to be aware that most browsers will speak HTTP/2 only on <code>https:</code>
URLs, so you need a server with SSL support. But not only that, you will need a SSL library
that supports the <code>ALPN</code> extension. If OpenSSL is the library you use, you need
<p>This allows only HTTP/1 on connections, except SSL connections to <code>test.example.org</code>
which offer HTTP/2.</p>
<divclass="note"><h3>Choose a strong SSLCipherSuite</h3>
<p>The <codeclass="directive"><ahref="../mod/mod_ssl.html#sslciphersuite">SSLCipherSuite</a></code> needs to be configured with a strong TLS cipher suite. The current version of mod_http2 does not enforce any cipher but most clients do so. Pointing a browser to a <code>h2</code> enabled server with a inappropriate cipher suite will force it to simply refuse and fall back to HTTP 1.1. This is a common mistake that is done while configuring httpd for HTTP/2 the first time, so please keep it in mind to avoid long debugging sessions! If you want to be sure about the cipher suite to choose please avoid the ones listed in the <ahref="http://httpwg.org/specs/rfc7540.html#BadCipherSuites">HTTP/2 TLS blacklist</a>.</p>
<p>The <codeclass="directive"><ahref="../mod/mod_ssl.html#sslciphersuite">SSLCipherSuite</a></code> needs to be configured with
a strong TLS cipher suite. The current version of <codeclass="module"><ahref="../mod/mod_http2.html">mod_http2</a></code> does not enforce any cipher but most
clients do so. Pointing a browser to a <code>h2</code> enabled server with a inappropriate
cipher suite will force it to simply refuse and fall back to HTTP 1.1. This is a common mistake
that is done while configuring httpd for HTTP/2 the first time, so please keep it in mind to avoid
long debugging sessions! If you want to be sure about the cipher suite to choose please avoid
the ones listed in the <ahref="http://httpwg.org/specs/rfc7540.html#BadCipherSuites">HTTP/2 TLS blacklist</a>.</p>
</div>
<p>The order of protocols mentioned is also relevant. By default, the first one is the
most preferred protocol. When a client offers multiple choices, the one most to the
@@ -151,12 +159,32 @@
ordering will decide.</p>
<p>A last thing: the protocols you configure are not checked for correctness
or spelling. You can mention protocols that do not exist, so there is no need
to guard <code>Protocols</code> with any <code>IfModule</code> checks.</p>
to guard <codeclass="directive"><ahref="../mod/core.html#protocols">Protocols</a></code> with any
<p>HTTP/2 is supported in all multi-processing modules that come with httpd. However, if
you use the <codeclass="module"><ahref="../mod/prefork.html">prefork</a></code> mpm, there will be severe restrictions.</p>
<p>In <codeclass="module"><ahref="../mod/prefork.html">prefork</a></code>, <codeclass="module"><ahref="../mod/mod_http2.html">mod_http2</a></code> will only process one request at at time
per connection. But clients, such as browsers, will send many requests at the same time.
If one of these takes long to process (or is a long polling one), the other requests will
stall.</p>
<p><codeclass="module"><ahref="../mod/mod_http2.html">mod_http2</a></code> will not work around this limit by default. The reason is that
<codeclass="module"><ahref="../mod/prefork.html">prefork</a></code> is today only chosen, if you run processing engines that are not
prepared for multi-threading, e.g. will crash with more than one request.</p>
<p>If your setup can handle it, configuring <codeclass="module"><ahref="../mod/event.html">event</a></code> mpm is nowadays
the best one (if supported on your platform).</p>
<p>If you are really stuck with <codeclass="module"><ahref="../mod/prefork.html">prefork</a></code> and want multiple requests,
you can tweak the <codeclass="directive"><ahref="../mod/mod_http2.html#h2minworkers">H2MinWorkers</a></code> to make
that possible. If it breaks, however, you own both parts.</p>
<p>Almost all modern browsers support HTTP/2, but only over SSL connections: Firefox (v43),
@@ -190,7 +218,10 @@
<li><ahref="https://nghttp2.org/documentation/h2load-howto.html">h2load</a> - useful to stress-test your server.</li>
</ul>
<p>Chrome offers detailed HTTP/2 logs on its connections via the
<ahref="chrome://net-internals/#http2">special net-internals page</a>. There is also an interesting extension for <ahref="https://chrome.google.com/webstore/detail/http2-and-spdy-indicator/mpbpobfflnpcgagjijhmgnchggcjblin?hl=en">Chrome</a> and <ahref="https://addons.mozilla.org/en-us/firefox/addon/spdy-indicator/">Firefox</a> to visualize when your browser is using HTTP/2.</p>
<ahref="chrome://net-internals/#http2">special net-internals page</a>. There is also an
interesting extension for <ahref="https://chrome.google.com/webstore/detail/http2-and-spdy-indicator/mpbpobfflnpcgagjijhmgnchggcjblin?hl=en">Chrome</a>
and <ahref="https://addons.mozilla.org/en-us/firefox/addon/spdy-indicator/">Firefox</a>
to visualize when your browser is using HTTP/2.</p>