1 <?xml version="1.0" encoding="ISO-8859-1"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>
4 <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type" />
6 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
7 This file is generated from xml source: DO NOT EDIT
8 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
10 <title>mod_http2 - Apache HTTP Server Version 2.5</title>
11 <link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
12 <link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
13 <link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" /><link rel="stylesheet" type="text/css" href="../style/css/prettify.css" />
14 <script src="../style/scripts/prettify.min.js" type="text/javascript">
17 <link href="../images/favicon.ico" rel="shortcut icon" /></head>
19 <div id="page-header">
20 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/quickreference.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p>
21 <p class="apache">Apache HTTP Server Version 2.5</p>
22 <img alt="" src="../images/feather.gif" /></div>
23 <div class="up"><a href="./"><img title="<-" alt="<-" src="../images/left.gif" /></a></div>
25 <a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP Server</a> > <a href="http://httpd.apache.org/docs/">Documentation</a> > <a href="../">Version 2.5</a> > <a href="./">Modules</a></div>
26 <div id="page-content">
27 <div id="preamble"><h1>Apache Module mod_http2</h1>
29 <p><span>Available Languages: </span><a href="../en/mod/mod_http2.html" title="English"> en </a></p>
31 <table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>Support for the HTTP/2 transport layer</td></tr>
32 <tr><th><a href="module-dict.html#Status">Status:</a></th><td>Extension</td></tr>
33 <tr><th><a href="module-dict.html#ModuleIdentifier">Module Identifier:</a></th><td>http2_module</td></tr>
34 <tr><th><a href="module-dict.html#SourceFile">Source File:</a></th><td>mod_http2.c</td></tr>
35 <tr><th><a href="module-dict.html#Compatibility">Compatibility:</a></th><td>Available in version 2.4.17 and later</td></tr></table>
38 <p>This module provides HTTP/2 (RFC 7540) support for the Apache
41 <p>This module relies on <a href="http://nghttp2.org/">libnghttp2</a>
42 to provide the core http/2 engine.</p>
44 <div class="warning"><h3>Warning</h3>
45 <p>This module is experimental. Its behaviors, directives, and
46 defaults are subject to more change from release to
47 release relative to other standard modules. Users are encouraged to
48 consult the "CHANGES" file for potential updates.</p>
51 <p>You must enable HTTP/2 via <code class="directive"><a href="../mod/core.html#protocols">Protocols</a></code> in order to use the
52 functionality described in this document:</p>
54 <pre class="prettyprint lang-config">Protocols h2 http/1.1</pre>
58 <div id="quickview"><h3>Topics</h3>
60 <li><img alt="" src="../images/down.gif" /> <a href="#envvars">Environment Variables</a></li>
61 </ul><h3 class="directives">Directives</h3>
63 <li><img alt="" src="../images/down.gif" /> <a href="#h2direct">H2Direct</a></li>
64 <li><img alt="" src="../images/down.gif" /> <a href="#h2keepalivetimeout">H2KeepAliveTimeout</a></li>
65 <li><img alt="" src="../images/down.gif" /> <a href="#h2maxsessionstreams">H2MaxSessionStreams</a></li>
66 <li><img alt="" src="../images/down.gif" /> <a href="#h2maxworkeridleseconds">H2MaxWorkerIdleSeconds</a></li>
67 <li><img alt="" src="../images/down.gif" /> <a href="#h2maxworkers">H2MaxWorkers</a></li>
68 <li><img alt="" src="../images/down.gif" /> <a href="#h2minworkers">H2MinWorkers</a></li>
69 <li><img alt="" src="../images/down.gif" /> <a href="#h2moderntlsonly">H2ModernTLSOnly</a></li>
70 <li><img alt="" src="../images/down.gif" /> <a href="#h2push">H2Push</a></li>
71 <li><img alt="" src="../images/down.gif" /> <a href="#h2pushdiarysize">H2PushDiarySize</a></li>
72 <li><img alt="" src="../images/down.gif" /> <a href="#h2pushpriority">H2PushPriority</a></li>
73 <li><img alt="" src="../images/down.gif" /> <a href="#h2serializeheaders">H2SerializeHeaders</a></li>
74 <li><img alt="" src="../images/down.gif" /> <a href="#h2sessionextrafiles">H2SessionExtraFiles</a></li>
75 <li><img alt="" src="../images/down.gif" /> <a href="#h2streammaxmemsize">H2StreamMaxMemSize</a></li>
76 <li><img alt="" src="../images/down.gif" /> <a href="#h2streamtimeout">H2StreamTimeout</a></li>
77 <li><img alt="" src="../images/down.gif" /> <a href="#h2timeout">H2Timeout</a></li>
78 <li><img alt="" src="../images/down.gif" /> <a href="#h2tlscooldownsecs">H2TLSCoolDownSecs</a></li>
79 <li><img alt="" src="../images/down.gif" /> <a href="#h2tlswarmupsize">H2TLSWarmUpSize</a></li>
80 <li><img alt="" src="../images/down.gif" /> <a href="#h2upgrade">H2Upgrade</a></li>
81 <li><img alt="" src="../images/down.gif" /> <a href="#h2windowsize">H2WindowSize</a></li>
83 <ul class="seealso"><li><a href="#comments_section">Comments</a></li></ul></div>
84 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
86 <h2><a name="envvars" id="envvars">Environment Variables</a></h2>
88 <p>This module can be configured to provide HTTP/2 related information
89 as additional environment variables to the SSI and CGI namespace.
92 <table class="bordered">
95 <th><a name="table3">Variable Name:</a></th>
99 <tr><td><code>HTTPe</code></td> <td>flag</td> <td>HTTP/2 is being used.</td></tr>
100 <tr><td><code>H2PUSH</code></td> <td>flag</td> <td>HTTP/2 Server Push is enabled for this request and also supported by the client.</td></tr>
104 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
105 <div class="directive-section"><h2><a name="H2Direct" id="H2Direct">H2Direct</a> <a name="h2direct" id="h2direct">Directive</a></h2>
106 <table class="directive">
107 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>H2 Direct Protocol Switch</td></tr>
108 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>H2Direct on|off</code></td></tr>
109 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>H2Direct on for h2c, off for h2 protocol</code></td></tr>
110 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
111 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
112 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_http2</td></tr>
115 This directive toggles the usage of the HTTP/2 Direct Mode. This
116 should be used inside a
117 <code class="directive"><a href="../mod/core.html#virtualhost"><VirtualHost></a></code>
118 section to enable direct HTTP/2 communication for that virtual host.
121 Direct communication means that if the first bytes received by the
122 server on a connection match the HTTP/2 preamble, the HTTP/2
123 protocol is switched to immediately without further negotiation.
124 This mode is defined in RFC 7540 for the cleartext (h2c) case. Its
125 use on TLS connections not mandated by the standard.
128 When a server/vhost does not have h2 or h2c enabled via
129 <code class="directive"><a href="../mod/core.html#protocols"><Protocols></a></code>,
130 the connection is never inspected for a HTTP/2 preamble. H2Direct
131 does not matter then. This is important for connections that
132 use protocols where an initial read might hang indefinitely, such
136 For clients that have out-of-band knowledge about a server
137 supporting h2c, direct HTTP/2 saves the client from having to
138 perform an HTTP/1.1 upgrade, resulting in better performance
139 and avoiding the Upgrade restrictions on request bodies.
142 This makes direct h2c attractive for server to server communication
143 as well, when the connection can be trusted or is secured by other means.
145 <div class="example"><h3>Example</h3><pre class="prettyprint lang-config">H2Direct on</pre>
149 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
150 <div class="directive-section"><h2><a name="H2KeepAliveTimeout" id="H2KeepAliveTimeout">H2KeepAliveTimeout</a> <a name="h2keepalivetimeout" id="h2keepalivetimeout">Directive</a></h2>
151 <table class="directive">
152 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Timeout (in seconds) for idle HTTP/2 connections</td></tr>
153 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>H2KeepAliveTimeout seconds</code></td></tr>
154 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
155 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
156 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_http2</td></tr>
157 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in version 2.4.19 and later.</td></tr>
160 This directive sets the timeout for read/write operations on
161 idle connections where HTTP/2 is negotiated. This can be used server wide or for specific
162 <code class="directive"><a href="../mod/core.html#virtualhost"><VirtualHost></a></code>s.
165 This directive is similar to the
166 <code class="directive"><a href="../mod/core.html#keepalivetimeout"><KeepAliveTimeout></a></code>, but
167 applies only to HTTP/2 connections. A HTTP/2 connection is considered
168 idle when no streams are open, e.g. no requests are ongoing.
171 By default, for non-async MPMs (prefork, worker) the keepalive timeout
172 will be the same as H2Timeout. For async MPMs, the keepalive handling for
173 HTTP/1 connections applies as no special action is taken.
177 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
178 <div class="directive-section"><h2><a name="H2MaxSessionStreams" id="H2MaxSessionStreams">H2MaxSessionStreams</a> <a name="h2maxsessionstreams" id="h2maxsessionstreams">Directive</a></h2>
179 <table class="directive">
180 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maximum number of active streams per HTTP/2 session.</td></tr>
181 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>H2MaxSessionStreams <em>n</em></code></td></tr>
182 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>H2MaxSessionStreams 100</code></td></tr>
183 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
184 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
185 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_http2</td></tr>
188 This directive sets the maximum number of active streams per HTTP/2 session (e.g. connection)
189 that the server allows. A stream is active if it is not <code>idle</code> or
190 <code>closed</code> according to RFC 7540.
192 <div class="example"><h3>Example</h3><pre class="prettyprint lang-config">H2MaxSessionStreams 20</pre>
196 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
197 <div class="directive-section"><h2><a name="H2MaxWorkerIdleSeconds" id="H2MaxWorkerIdleSeconds">H2MaxWorkerIdleSeconds</a> <a name="h2maxworkeridleseconds" id="h2maxworkeridleseconds">Directive</a></h2>
198 <table class="directive">
199 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maximum number of seconds h2 workers remain idle until shut down.</td></tr>
200 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>H2MaxWorkerIdleSeconds <em>n</em></code></td></tr>
201 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>H2MaxWorkerIdleSeconds 600</code></td></tr>
202 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
203 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
204 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_http2</td></tr>
207 This directive sets the maximum number of seconds a h2 worker may
208 idle until it shuts itself down. This only happens while the number of
209 h2 workers exceeds <code>H2MinWorkers</code>.
211 <div class="example"><h3>Example</h3><pre class="prettyprint lang-config">H2MaxWorkerIdleSeconds 20</pre>
215 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
216 <div class="directive-section"><h2><a name="H2MaxWorkers" id="H2MaxWorkers">H2MaxWorkers</a> <a name="h2maxworkers" id="h2maxworkers">Directive</a></h2>
217 <table class="directive">
218 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maximum number of worker threads to use per child process.</td></tr>
219 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>H2MaxWorkers <em>n</em></code></td></tr>
220 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
221 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
222 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_http2</td></tr>
225 This directive sets the maximum number of worker threads to spawn
226 per child process for HTTP/2 processing. If this directive is not used,
227 <code>mod_http2</code> will chose a value suitable for the <code>mpm</code>
230 <div class="example"><h3>Example</h3><pre class="prettyprint lang-config">H2MaxWorkers 20</pre>
234 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
235 <div class="directive-section"><h2><a name="H2MinWorkers" id="H2MinWorkers">H2MinWorkers</a> <a name="h2minworkers" id="h2minworkers">Directive</a></h2>
236 <table class="directive">
237 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Minimal number of worker threads to use per child process.</td></tr>
238 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>H2MinWorkers <em>n</em></code></td></tr>
239 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
240 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
241 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_http2</td></tr>
244 This directive sets the minimum number of worker threads to spawn
245 per child process for HTTP/2 processing. If this directive is not used,
246 <code>mod_http2</code> will chose a value suitable for the <code>mpm</code>
249 <div class="example"><h3>Example</h3><pre class="prettyprint lang-config">H2MinWorkers 10</pre>
253 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
254 <div class="directive-section"><h2><a name="H2ModernTLSOnly" id="H2ModernTLSOnly">H2ModernTLSOnly</a> <a name="h2moderntlsonly" id="h2moderntlsonly">Directive</a></h2>
255 <table class="directive">
256 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Require HTTP/2 connections to be "modern TLS" only</td></tr>
257 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>H2ModernTLSOnly on|off</code></td></tr>
258 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>H2ModernTLSOnly on</code></td></tr>
259 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
260 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
261 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_http2</td></tr>
262 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in version 2.4.18 and later.</td></tr>
265 This directive toggles the security checks on HTTP/2 connections
266 in TLS mode (https:). This can be used server wide or for specific
267 <code class="directive"><a href="../mod/core.html#virtualhost"><VirtualHost></a></code>s.
270 The security checks require that the TSL protocol is at least
271 TLSv1.2 and that none of the ciphers listed in RFC 7540, Appendix A
272 is used. These checks will be extended once new security requirements
276 The name stems from the
277 <a href="https://wiki.mozilla.org/Security/Server_Side_TLS">Security/Server Side TLS</a>
278 definitions at mozilla where "modern compatibility" is defined. Mozilla Firefox and
279 other browsers require modern compatibility for HTTP/2 connections. As everything
280 in OpSec, this is a moving target and can be expected to evolve in the future.
283 One purpose of having these checks in mod_http2 is to enforce this
284 security level for all connections, not only those from browsers. The other
285 purpose is to prevent the negotiation of HTTP/2 as a protocol should
286 the requirements not be met.
289 Ultimately, the security of the TLS connection is determined by the
290 server configuration directives for mod_ssl.
292 <div class="example"><h3>Example</h3><pre class="prettyprint lang-config">H2ModernTLSOnly off</pre>
296 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
297 <div class="directive-section"><h2><a name="H2Push" id="H2Push">H2Push</a> <a name="h2push" id="h2push">Directive</a></h2>
298 <table class="directive">
299 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>H2 Server Push Switch</td></tr>
300 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>H2Push on|off</code></td></tr>
301 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>H2Push on</code></td></tr>
302 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
303 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
304 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_http2</td></tr>
305 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in version 2.4.18 and later.</td></tr>
308 This directive toggles the usage of the HTTP/2 server push
309 protocol feature. This should be used inside a
310 <code class="directive"><a href="../mod/core.html#virtualhost"><VirtualHost></a></code>
311 section to enable direct HTTP/2 communication for that virtual host.
314 The HTTP/2 protocol allows the server to push other resources to
315 a client when it asked for a particular one. This is helpful
316 if those resources are connected in some way and the client can
317 be expected to ask for it anyway. The pushing then saves the
318 time it takes the client to ask for the resources itself. On the
319 other hand, pushing resources the client never needs or already
320 has is a waste of bandwidth.
323 Server pushes are detected by inspecting the <code>Link</code> headers of
324 responses (see https://tools.ietf.org/html/rfc5988 for the
325 specification). When a link thus specified has the <code>rel=preload</code>
326 attribute, it is treated as a resource to be pushed.
329 Link headers in responses are either set by the application or
330 can be configured via <code class="module"><a href="../mod/mod_headers.html">mod_headers</a></code> as:
332 <div class="example"><h3>mod_headers example</h3><pre class="prettyprint lang-config"><Location /index.html>
333 Header add Link "</css/site.css>;rel=preload"
334 Header add Link "</images/logo.jpg>;rel=preload"
335 </Location></pre>
338 As the example shows, there can be several link headers added
339 to a response, resulting in several pushes being triggered. There
340 are no checks in the module to avoid pushing the same resource
341 twice or more to one client. Use with care.
344 HTTP/2 server pushes are enabled by default. This directive
345 allows it to be switch off on all resources of this server/virtual
348 <div class="example"><h3>Example</h3><pre class="prettyprint lang-config">H2Push off</pre>
351 Last but not least, pushes happen only when the client signals
352 its willingness to accept those. Most browsers do, some, like Safari 9,
353 do not. Also, pushes also only happen for resources from the same
354 <em>authority</em> as the original response is for.
358 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
359 <div class="directive-section"><h2><a name="H2PushDiarySize" id="H2PushDiarySize">H2PushDiarySize</a> <a name="h2pushdiarysize" id="h2pushdiarysize">Directive</a></h2>
360 <table class="directive">
361 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>H2 Server Push Diary Size</td></tr>
362 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>H2PushDiarySize n</code></td></tr>
363 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>H2PushDiarySize 128</code></td></tr>
364 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
365 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
366 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_http2</td></tr>
367 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in version 2.4.19 and later.</td></tr>
370 This directive toggles the maximum number of HTTP/2 server pushes
371 that are remembered per HTTP/2 connection. This can be used inside the
372 <code class="directive"><a href="../mod/core.html#virtualhost"><VirtualHost></a></code>
373 section to influence the number for all connections to that virtual host.
376 The push diary records a digest (currently using SHA256) of pushed
377 resources (their URL) to avoid duplicate pushes on the same connection.
378 These value are not persisted, so clients openeing a new connection
379 will experience known pushes again. There is ongoing work to enable
380 a client to disclose a digest of the resources it already has, so
381 the diary maybe initialized by the client on each connection setup.
384 If the maximum size is reached, newer entries replace the oldest
385 ones. Using SHA256, each diary entry uses 32 bytes, letting a
386 default diary with 128 entries consume around 4 KB of memory.
389 A size of 0 will effectively disable the push diary.
393 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
394 <div class="directive-section"><h2><a name="H2PushPriority" id="H2PushPriority">H2PushPriority</a> <a name="h2pushpriority" id="h2pushpriority">Directive</a></h2>
395 <table class="directive">
396 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>H2 Server Push Priority</td></tr>
397 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>H2PushPriority mime-type [after|before|interleaved] [weight]</code></td></tr>
398 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>H2PushPriority * After 16</code></td></tr>
399 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
400 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
401 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_http2</td></tr>
402 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in version 2.4.18 and later. For having an
403 effect, a nghttp2 library version 1.5.0 or newer is necessary.</td></tr>
406 This directive defines the priority handling of pushed responses
407 based on the content-type of the response. This is usually defined
408 per server config, but may also appear in a virtual host.
411 HTTP/2 server pushes are always related to a client request. Each
412 such request/response pairs, or <em>streams</em> have a dependency
413 and a weight, together defining the <em>priority</em> of a stream.
416 When a stream <em>depends</em> on another, say X depends on Y,
417 then Y gets all bandwidth before X gets any. Note that this
418 does not men that Y will block X. If Y has no data to send,
419 all bandwidth allocated to Y can be used by X.
422 When a stream has more than one dependant, say X1 and X2 both
423 depend on Y, the <em>weight</em> determines the bandwidth
424 allocation. If X1 and X2 have the same weight, they both get
425 half of the available bandwdith. If the weight of X1 is twice
426 as large as that for X2, X1 gets twice the bandwidth of X2.
429 Ultimately, every stream depends on the <em>root</em> stream which
430 gets all the bandwidht available, but never sends anything. So all
431 its bandwidth is distributed by weight among its children. Which
432 either have data to send or distribute the bandwidth to their
433 own children. And so on. If none of the children have data
434 to send, that bandwidth get distributed somewhere else according
438 The purpose of this priority system is to always make use of
439 available bandwidth while allowing precedence and weight
440 to be given to specific streams. Since, normally, all streams
441 are initiated by the client, it is also the one that sets
445 Only when such a stream results in a PUSH, gets the server to
446 decide what the <em>initial</em> priority of such a pushed
447 stream is. In the examples below, X is the client stream. It
448 depends on Y and the server decides to PUSH streams P1 and P2
452 The default priority rule is:
454 <div class="example"><h3>Default Priority Rule</h3><pre class="prettyprint lang-config">H2PushPriority * After 16</pre>
457 which reads as 'Send a pushed stream of any content-type
458 depending on the client stream with weight 16'. And so P1
459 and P2 will be send after X and, as they have equal weight,
460 share bandwidth equally among themselves.
462 <div class="example"><h3>Interleaved Priority Rule</h3><pre class="prettyprint lang-config">H2PushPriority text/css Interleaved 256</pre>
465 which reads as 'Send any CSS resource on the same dependency and
466 weight as the client stream'. If P1 has content-type 'text/css',
467 it will depend on Y (as does X) and its effective weight will be
468 calculated as <code>P1ew = Xw * (P1w / 256)</code>. With P1w being
469 256, this will make the effective weight the same as the weight
470 of X. If both X and P1 have data to send, bandwidth will be allocated
474 With Pw specified as 512, a pushed, interleaved stream would
475 get double the weight of X. With 128 only half as much. Note that
476 effective weights are always capped at 256.
478 <div class="example"><h3>Before Priority Rule</h3><pre class="prettyprint lang-config">H2PushPriority application/json Before</pre>
481 This says that any pushed stream of content type 'application/json'
482 should be send out <em>before</em> X. This makes P1 dependent
483 on Y and X dependent on P1. So, X will be stalled as long as
484 P1 has data to send. The effective weight is inherited from the
485 client stream. Specifying a weight is not allowed.
488 Be aware that the effect of priority specifications is limited
489 by the available server resources. If a server does not have
490 workers available for pushed streams, the data for the stream
491 may only ever arrive when other streams have been finished.
494 Last, but not least, there are some specifics of the syntax
495 to be used in this directive:
498 <li>'*' is the only special content-type that matches all others.
499 'image/*' will not work.</li>
500 <li>The default dependency is 'After'. </li>
501 <li>There are also default weights: for 'After' it is 16, 'interleaved' is 256.
504 <div class="example"><h3>Shorter Priority Rules</h3><pre class="prettyprint lang-config">H2PushPriority application/json 32 # an After rule
505 H2PushPriority image/jpeg before # weight inherited
506 H2PushPriority text/css interleaved # weight 256 default</pre>
510 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
511 <div class="directive-section"><h2><a name="H2SerializeHeaders" id="H2SerializeHeaders">H2SerializeHeaders</a> <a name="h2serializeheaders" id="h2serializeheaders">Directive</a></h2>
512 <table class="directive">
513 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Serialize Request/Response Processing Switch</td></tr>
514 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>H2SerializeHeaders on|off</code></td></tr>
515 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>H2SerializeHeaders off</code></td></tr>
516 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
517 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
518 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_http2</td></tr>
521 This directive toggles if HTTP/2 requests shall be serialized in
522 HTTP/1.1 format for processing by <code>httpd</code> core or if
523 received binary data shall be passed into the <code>request_rec</code>s
527 Serialization will lower performance, but gives more backward
528 compatibility in case custom filters/hooks need it.
530 <div class="example"><h3>Example</h3><pre class="prettyprint lang-config">H2SerializeHeaders on</pre>
534 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
535 <div class="directive-section"><h2><a name="H2SessionExtraFiles" id="H2SessionExtraFiles">H2SessionExtraFiles</a> <a name="h2sessionextrafiles" id="h2sessionextrafiles">Directive</a></h2>
536 <table class="directive">
537 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Number of Extra File Handles</td></tr>
538 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>H2SessionExtraFiles <em>n</em></code></td></tr>
539 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
540 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
541 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_http2</td></tr>
544 This directive sets maximum number of <em>extra</em> file handles
545 a HTTP/2 session is allowed to use. A file handle is counted as
546 <em>extra</em> when it is transferred from a h2 worker thread to
547 the main HTTP/2 connection handling. This commonly happens when
548 serving static files.
550 Depending on the processing model configured on the server, the
551 number of connections times number of active streams may exceed
552 the number of file handles for the process. On the other hand,
553 converting every file into memory bytes early results in too
554 many buffer writes. This option helps to mitigate that.
556 The number of file handles used by a server process is then in
559 <pre>(h2_connections * extra_files) + (h2_max_worker)</pre>
560 <div class="example"><h3>Example</h3><pre class="prettyprint lang-config">H2SessionExtraFiles 10</pre>
563 If nothing is configured, the module tries to make a conservative
564 guess how many files are safe to use. This depends largely on the
569 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
570 <div class="directive-section"><h2><a name="H2StreamMaxMemSize" id="H2StreamMaxMemSize">H2StreamMaxMemSize</a> <a name="h2streammaxmemsize" id="h2streammaxmemsize">Directive</a></h2>
571 <table class="directive">
572 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maximum amount of output data buffered per stream.</td></tr>
573 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>H2StreamMaxMemSize <em>bytes</em></code></td></tr>
574 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>H2StreamMaxMemSize 65536</code></td></tr>
575 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
576 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
577 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_http2</td></tr>
580 This directive sets the maximum number of outgoing data bytes buffered in memory
581 for an active streams. This memory is not allocated per stream as such. Allocations
582 are counted against this limit when they are about to be done. Stream processing
583 freezes when the limit has been reached and will only continue when buffered data
584 has been sent out to the client.
586 <div class="example"><h3>Example</h3><pre class="prettyprint lang-config">H2StreamMaxMemSize 128000</pre>
590 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
591 <div class="directive-section"><h2><a name="H2StreamTimeout" id="H2StreamTimeout">H2StreamTimeout</a> <a name="h2streamtimeout" id="h2streamtimeout">Directive</a></h2>
592 <table class="directive">
593 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Timeout (in seconds) for idle HTTP/2 connections</td></tr>
594 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>H2StreamTimeout seconds</code></td></tr>
595 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>H2StreamTimeout 0</code></td></tr>
596 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
597 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
598 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_http2</td></tr>
599 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in version 2.4.19 and later.</td></tr>
602 This directive sets the timeout for read/write operations on
603 HTTP/2 streams, e.g. individual requests. This can be used server wide or for specific
604 <code class="directive"><a href="../mod/core.html#virtualhost"><VirtualHost></a></code>s.
607 Due to the nature of HTTP/2, which sends multiple requests over a single
608 connection and has priority scheduling, individual streams might not
609 see input for much longer times than HTTP/1.1 requests would.
612 A value of 0 enforces no timeout, so could wait on chances to receive
613 input or write data indefinitely. This expose a server to
614 risks of thread exhaustion.
617 Depending on your handling of pushed streams,
618 priorities and general responsiveness, a site might need to increase
619 this value. For example, if you PUSH a large resource <em>before</em>
620 the requested one, the initial stream will not write until the
621 pushed resource is fully sent.
625 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
626 <div class="directive-section"><h2><a name="H2Timeout" id="H2Timeout">H2Timeout</a> <a name="h2timeout" id="h2timeout">Directive</a></h2>
627 <table class="directive">
628 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Timeout (in seconds) for HTTP/2 connections</td></tr>
629 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>H2Timeout seconds</code></td></tr>
630 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>H2Timeout 5</code></td></tr>
631 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
632 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
633 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_http2</td></tr>
634 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in version 2.4.19 and later.</td></tr>
637 This directive sets the timeout for read/write operations on
638 connections where HTTP/2 is negotiated. This can be used server wide or for specific
639 <code class="directive"><a href="../mod/core.html#virtualhost"><VirtualHost></a></code>s.
642 This directive is similar to the
643 <code class="directive"><a href="../mod/core.html#timeout"><Timeout></a></code>, but
644 applies only to HTTP/2 connections.
647 A value of 0 enforces no timeout.
651 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
652 <div class="directive-section"><h2><a name="H2TLSCoolDownSecs" id="H2TLSCoolDownSecs">H2TLSCoolDownSecs</a> <a name="h2tlscooldownsecs" id="h2tlscooldownsecs">Directive</a></h2>
653 <table class="directive">
654 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td /></tr>
655 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>H2TLSCoolDownSecs seconds</code></td></tr>
656 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>H2TLSCoolDownSecs 1</code></td></tr>
657 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
658 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
659 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_http2</td></tr>
660 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in version 2.4.18 and later.</td></tr>
663 This directive sets the number of seconds of idle time on a TLS
664 connection before the TLS write size falls back to small (~1300 bytes)
666 This can be used server wide or for specific
667 <code class="directive"><a href="../mod/core.html#virtualhost"><VirtualHost></a></code>s.
670 See <code class="directive"><H2TLSWarmUpSize></code> for a
671 description of TLS warmup. H2TLSCoolDownSecs reflects the fact
672 that connections may deteriorate over time (and TCP flow adjusts)
673 for idle connections as well. It is beneficial to overall performance
674 to fall back to the pre-warmup phase after a number of seconds that
675 no data has been sent.
678 In deployments where connections can be considered reliable, this
679 timer can be disabled by setting it to 0.
682 The following example sets the seconds to zero, effectively disabling
683 any cool down. Warmed up TLS connections stay on maximum record
686 <div class="example"><h3>Example</h3><pre class="prettyprint lang-config">H2TLSCoolDownSecs 0</pre>
690 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
691 <div class="directive-section"><h2><a name="H2TLSWarmUpSize" id="H2TLSWarmUpSize">H2TLSWarmUpSize</a> <a name="h2tlswarmupsize" id="h2tlswarmupsize">Directive</a></h2>
692 <table class="directive">
693 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td /></tr>
694 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>H2TLSWarmUpSize amount</code></td></tr>
695 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>H2TLSWarmUpSize 1048576</code></td></tr>
696 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
697 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
698 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_http2</td></tr>
699 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in version 2.4.18 and later.</td></tr>
702 This directive sets the number of bytes to be sent in small
703 TLS records (~1300 bytes) until doing maximum sized writes (16k)
704 on https: HTTP/2 connections.
705 This can be used server wide or for specific
706 <code class="directive"><a href="../mod/core.html#virtualhost"><VirtualHost></a></code>s.
709 Measurements by <a href="https://www.igvita.com">google performance
710 labs</a> show that best performance on TLS connections is reached,
711 if initial record sizes stay below the MTU level, to allow a
712 complete record to fit into an IP packet.
715 While TCP adjust its flow-control and window sizes, longer TLS
716 records can get stuck in queues or get lost and need retransmission.
717 This is of course true for all packets. TLS however needs the
718 whole record in order to decrypt it. Any missing bytes at the end
719 will stall usage of the received ones.
722 After a sufficient number of bytes have been send successfully,
723 the TCP state of the connection is stable and maximum TLS record
724 sizes (16 KB) can be used for optimal performance.
727 In deployments where servers are reached locally or over reliable
728 connections only, the value might be decreased with 0 disabling
729 any warmup phase altogether.
732 The following example sets the size to zero, effectively disabling
735 <div class="example"><h3>Example</h3><pre class="prettyprint lang-config">H2TLSWarmUpSize 0</pre>
739 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
740 <div class="directive-section"><h2><a name="H2Upgrade" id="H2Upgrade">H2Upgrade</a> <a name="h2upgrade" id="h2upgrade">Directive</a></h2>
741 <table class="directive">
742 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>H2 Upgrade Protocol Switch</td></tr>
743 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>H2Upgrade on|off</code></td></tr>
744 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>H2Upgrade on for h2c, off for h2 protocol</code></td></tr>
745 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
746 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
747 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_http2</td></tr>
750 This directive toggles the usage of the HTTP/1.1 Upgrade method
751 for switching to HTTP/2. This
752 should be used inside a
753 <code class="directive"><a href="../mod/core.html#virtualhost"><VirtualHost></a></code>
754 section to enable Upgrades to HTTP/2 for that virtual host.
757 This method of switching protocols is defined in HTTP/1.1 and
758 uses the "Upgrade" header (thus the name) to announce willingness
759 to use another protocol. This may happen on any request of a
763 This method of protocol switching is enabled by default on cleartext
764 (potential h2c) connections and disabled on TLS (potential h2),
765 as mandated by RFC 7540.
768 Please be aware that Upgrades are only accepted for requests
769 that carry no body. POSTs and PUTs with content will never
770 trigger an upgrade to HTTP/2.
771 See <code class="directive"><H2Direct></code> for an
772 alternative to Upgrade.
775 This mode only has an effect when h2 or h2c is enabled via
776 the <code class="directive"><a href="../mod/core.html#protocols"><Protocols></a></code>.
778 <div class="example"><h3>Example</h3><pre class="prettyprint lang-config">H2Upgrade on</pre>
782 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
783 <div class="directive-section"><h2><a name="H2WindowSize" id="H2WindowSize">H2WindowSize</a> <a name="h2windowsize" id="h2windowsize">Directive</a></h2>
784 <table class="directive">
785 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Size of Stream Window for upstream data.</td></tr>
786 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>H2WindowSize <em>bytes</em></code></td></tr>
787 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>H2WindowSize 65535</code></td></tr>
788 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
789 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
790 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_http2</td></tr>
793 This directive sets the size of the window that is used for flow control
794 from client to server and limits the amount of data the server has to buffer.
795 The client will stop sending on a stream once the limit has been reached until
796 the server announces more available space (as it has processed some of the data).
798 This limit affects only request bodies, not its meta data such as headers. Also,
799 it has no effect on response bodies as the window size for those are managed
802 <div class="example"><h3>Example</h3><pre class="prettyprint lang-config">H2WindowSize 128000</pre>
807 <div class="bottomlang">
808 <p><span>Available Languages: </span><a href="../en/mod/mod_http2.html" title="English"> en </a></p>
809 </div><div class="top"><a href="#page-header"><img src="../images/up.gif" alt="top" /></a></div><div class="section"><h2><a id="comments_section" name="comments_section">Comments</a></h2><div class="warning"><strong>Notice:</strong><br />This is not a Q&A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our <a href="http://httpd.apache.org/lists.html">mailing lists</a>.</div>
810 <script type="text/javascript"><!--//--><![CDATA[//><!--
811 var comments_shortname = 'httpd';
812 var comments_identifier = 'http://httpd.apache.org/docs/trunk/mod/mod_http2.html';
814 if (w.location.hostname.toLowerCase() == "httpd.apache.org") {
815 d.write('<div id="comments_thread"><\/div>');
816 var s = d.createElement('script');
817 s.type = 'text/javascript';
819 s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
820 (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
823 d.write('<div id="comments_thread">Comments are disabled for this page at the moment.<\/div>');
825 })(window, document);
826 //--><!]]></script></div><div id="footer">
827 <p class="apache">Copyright 2016 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
828 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/quickreference.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p></div><script type="text/javascript"><!--//--><![CDATA[//><!--
829 if (typeof(prettyPrint) !== 'undefined') {