Subversion Repositories Integrator Subversion

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
771 blopes 1
<!DOCTYPE html SYSTEM "about:legacy-compat">
2
<html lang="en"><head><META http-equiv="Content-Type" content="text/html; charset=UTF-8"><link href="../images/docs-stylesheet.css" rel="stylesheet" type="text/css"><title>Apache Tomcat 9 Configuration Reference (9.0.112) - The HTTP2 Upgrade Protocol</title></head><body><div id="wrapper"><header><div id="header"><div><div><div class="logo noPrint"><a href="https://tomcat.apache.org/"><img alt="Tomcat Home" src="../images/tomcat.png"></a></div><div style="height: 1px;"></div><div class="asfLogo noPrint"><a href="https://www.apache.org/" target="_blank"><img src="../images/asf-logo.svg" alt="The Apache Software Foundation" style="width: 266px; height: 83px;"></a></div><h1>Apache Tomcat 9 Configuration Reference</h1><div class="versionInfo">
3
            Version 9.0.112,
4
            <time datetime="2025-11-06">Nov 6 2025</time></div><div style="height: 1px;"></div><div style="clear: left;"></div></div></div></div></header><div id="middle"><div><div id="mainLeft" class="noprint"><div><nav><div><h2>Links</h2><ul><li><a href="../index.html">Docs Home</a></li><li><a href="index.html">Config Ref. Home</a></li><li><a href="https://cwiki.apache.org/confluence/display/TOMCAT/FAQ">FAQ</a></li><li><a href="#comments_section">User Comments</a></li></ul></div><div><h2>Top Level Elements</h2><ul><li><a href="server.html">Server</a></li><li><a href="service.html">Service</a></li></ul></div><div><h2>Executors</h2><ul><li><a href="executor.html">Executor</a></li></ul></div><div><h2>Connectors</h2><ul><li><a href="http.html">HTTP/1.1</a></li><li><a href="http2.html">HTTP/2</a></li><li><a href="ajp.html">AJP</a></li></ul></div><div><h2>Containers</h2><ul><li><a href="context.html">Context</a></li><li><a href="engine.html">Engine</a></li><li><a href="host.html">Host</a></li><li><a href="cluster.html">Cluster</a></li></ul></div><div><h2>Nested Components</h2><ul><li><a href="cookie-processor.html">CookieProcessor</a></li><li><a href="credentialhandler.html">CredentialHandler</a></li><li><a href="globalresources.html">Global Resources</a></li><li><a href="jar-scanner.html">JarScanner</a></li><li><a href="jar-scan-filter.html">JarScanFilter</a></li><li><a href="listeners.html">Listeners</a></li><li><a href="loader.html">Loader</a></li><li><a href="manager.html">Manager</a></li><li><a href="realm.html">Realm</a></li><li><a href="resources.html">Resources</a></li><li><a href="sessionidgenerator.html">SessionIdGenerator</a></li><li><a href="valve.html">Valve</a></li></ul></div><div><h2>Cluster Elements</h2><ul><li><a href="cluster.html">Cluster</a></li><li><a href="cluster-manager.html">Manager</a></li><li><a href="cluster-channel.html">Channel</a></li><li><a href="cluster-membership.html">Channel/Membership</a></li><li><a href="cluster-sender.html">Channel/Sender</a></li><li><a href="cluster-receiver.html">Channel/Receiver</a></li><li><a href="cluster-interceptor.html">Channel/Interceptor</a></li><li><a href="cluster-valve.html">Valve</a></li><li><a href="cluster-deployer.html">Deployer</a></li><li><a href="cluster-listener.html">ClusterListener</a></li></ul></div><div><h2>web.xml</h2><ul><li><a href="filter.html">Filter</a></li></ul></div><div><h2>Other</h2><ul><li><a href="runtime-attributes.html">Runtime attributes</a></li><li><a href="systemprops.html">System properties</a></li><li><a href="jaspic.html">JASPIC</a></li></ul></div></nav></div></div><div id="mainRight"><div id="content"><h2>The HTTP2 Upgrade Protocol</h2><h3 id="Table_of_Contents">Table of Contents</h3><div class="text">
5
<ul><li><a href="#Introduction">Introduction</a></li><li><a href="#Attributes">Attributes</a><ol><li><a href="#Common_Attributes">Common Attributes</a></li><li><a href="#Standard_Implementation">Standard Implementation</a></li></ol></li><li><a href="#Nested_Components">Nested Components</a></li><li><a href="#Special_Features">Special Features</a></li></ul>
6
</div><h3 id="Introduction">Introduction</h3><div class="text">
7
 
8
  <p>The <strong>HTTP Upgrade Protocol</strong> element represents an
9
  <strong>Upgrade Protocol</strong> component that supports the HTTP/2 protocol.
10
  An instance of this component must be associated with an existing
11
  <a href="http.html">HTTP/1.1 Connector</a>.</p>
12
 
13
  <p>HTTP/2 connectors use non-blocking I/O, only utilising a container thread
14
  from the thread pool when there is data to read and write. However, because
15
  the Servlet API is fundamentally blocking, each HTTP/2 stream requires a
16
  dedicated container thread for the duration of that stream.</p>
17
 
18
  <p>Requests processed using HTTP/2 will have the following additional request
19
  attributes available:</p>
20
  <ul>
21
    <li><code>org.apache.coyote.connectionID</code> will return the HTTP/2
22
        connection ID</li>
23
    <li><code>org.apache.coyote.streamID</code> will return the HTTP/2 stream
24
        ID</li>
25
  </ul>
26
 
27
</div><h3 id="Attributes">Attributes</h3><div class="text">
28
 
29
  <div class="subsection"><h4 id="Common_Attributes">Common Attributes</h4><div class="text">
30
 
31
  <p>All implementations of <strong>Upgrade Protocol</strong> support the
32
  following attributes:</p>
33
 
34
  <table class="defaultTable"><tr><th style="width: 15%;">
35
          Attribute
36
        </th><th style="width: 85%;">
37
          Description
38
        </th></tr><tr id="Attributes_Common Attributes_className"><td><strong><code class="attributeName">className</code></strong></td><td>
39
      <p>This must be <code>org.apache.coyote.http2.Http2Protocol</code>.</p>
40
    </td></tr></table>
41
 
42
  </div></div>
43
 
44
  <div class="subsection"><h4 id="Standard_Implementation">Standard Implementation</h4><div class="text">
45
 
46
  <p>The HTTP/2 <strong>Upgrade Protocol</strong> implementation supports the
47
  following attributes in addition to the common attributes listed above.</p>
48
 
49
  <table class="defaultTable"><tr><th style="width: 15%;">
50
          Attribute
51
        </th><th style="width: 85%;">
52
          Description
53
        </th></tr><tr id="Attributes_Standard Implementation_allowedTrailerHeaders"><td><code class="attributeName">allowedTrailerHeaders</code></td><td>
54
      <p>By default Tomcat will ignore all trailer headers when processing
55
      HTTP/2 connections. For a header to be processed, it must be added to this
56
      comma-separated list of header names.</p>
57
    </td></tr><tr id="Attributes_Standard Implementation_compressibleMimeType"><td><code class="attributeName">compressibleMimeType</code></td><td>
58
      <p>The value is a comma separated list of MIME types for which HTTP
59
      compression may be used.
60
      The default value is
61
      <code>
62
      text/html,text/xml,text/plain,text/css,text/javascript,application/javascript,application/json,application/xml
63
      </code>.
64
      </p>
65
    </td></tr><tr id="Attributes_Standard Implementation_compression"><td><code class="attributeName">compression</code></td><td>
66
      <p>The HTTP/2 protocol may use compression in an attempt to save server
67
      bandwidth. The acceptable values for the parameter is "off" (disable
68
      compression), "on" (allow compression, which causes text data to be
69
      compressed), "force" (forces compression in all cases), or a numerical
70
      integer value (which is equivalent to "on", but specifies the minimum
71
      amount of data before the output is compressed). If the content-length is
72
      not known and compression is set to "on" or more aggressive, the output
73
      will also be compressed. If not specified, this attribute is set to
74
      "off".</p>
75
      <p><em>Note</em>: There is a tradeoff between using compression (saving
76
      your bandwidth) and using the sendfile feature (saving your CPU cycles).
77
      If the connector supports the sendfile feature, e.g. the NIO2 connector,
78
      using sendfile will take precedence over compression. The symptoms will
79
      be that static files greater that 48 Kb will be sent uncompressed.
80
      You can turn off sendfile by setting <code>useSendfile</code> attribute
81
      of the protocol, as documented below, or change the sendfile usage
82
      threshold in the configuration of the
83
      <a href="../default-servlet.html">DefaultServlet</a> in the default
84
      <code>conf/web.xml</code> or in the <code>web.xml</code> of your web
85
      application.
86
      </p>
87
    </td></tr><tr id="Attributes_Standard Implementation_compressionMinSize"><td><code class="attributeName">compressionMinSize</code></td><td>
88
      <p>If <strong>compression</strong> is set to "on" then this attribute
89
      may be used to specify the minimum amount of data before the output is
90
      compressed. If not specified, this attribute is defaults to "2048".</p>
91
    </td></tr><tr id="Attributes_Standard Implementation_discardRequestsAndResponses"><td><code class="attributeName">discardRequestsAndResponses</code></td><td>
92
      <p>A boolean value which can be used to enable or disable the recycling
93
      of the container internal request and response processing objects. If set
94
      to <code>true</code> the request and response objects will be set for
95
      garbage collection after every request, otherwise they will be reused.
96
      If not specified, this attribute is set to <code>false</code>.</p>
97
    </td></tr><tr id="Attributes_Standard Implementation_initialWindowSize"><td><code class="attributeName">initialWindowSize</code></td><td>
98
      <p>Controls the initial size of the flow control window for streams that
99
      Tomcat advertises to clients. If not specified, the default value of
100
      <code>65535</code> is used.</p>
101
    </td></tr><tr id="Attributes_Standard Implementation_keepAliveTimeout"><td><code class="attributeName">keepAliveTimeout</code></td><td>
102
      <p>The time, in milliseconds, that Tomcat will wait between HTTP/2 frames
103
      when there is no active Stream before closing the connection. Negative
104
      values will be treated as an infinite timeout. If not specified, a default
105
      value of <code>20000</code> will be used.</p>
106
    </td></tr><tr id="Attributes_Standard Implementation_maxConcurrentStreamExecution"><td><code class="attributeName">maxConcurrentStreamExecution</code></td><td>
107
      <p>The controls the maximum number of streams for any one connection that
108
      can be allocated threads from the container thread pool. If more streams
109
      are active than threads are available, those streams will have to wait
110
      for a stream to become available. If not specified, the default value of
111
      <code>20</code> will be used.</p>
112
    </td></tr><tr id="Attributes_Standard Implementation_maxConcurrentStreams"><td><code class="attributeName">maxConcurrentStreams</code></td><td>
113
      <p>The controls the maximum number of active streams permitted for any one
114
      connection. If a client attempts to open more active streams than this
115
      limit, the stream will be reset with a <code>STREAM_REFUSED</code> error.
116
      If not specified, the default value of <code>100</code> will be used.</p>
117
    </td></tr><tr id="Attributes_Standard Implementation_maxHeaderCount"><td><code class="attributeName">maxHeaderCount</code></td><td>
118
      <p>The maximum number of headers in a request that is allowed by the
119
      container. A request that contains more headers than the specified limit
120
      will be rejected. A value of less than 0 means no limit.
121
      If not specified, a default of 100 is used.</p>
122
    </td></tr><tr id="Attributes_Standard Implementation_maxHeaderSize"><td><code class="attributeName">maxHeaderSize</code></td><td>
123
      <p>The maximum total size for all headers in a request that is allowed by
124
      the container. Total size for a header is calculated as the uncompressed
125
      size of the header name in bytes, plus the uncompressed size of the header
126
      value in bytes plus an HTTP/2 overhead of 3 bytes per header. A request
127
      that contains a set of headers that requires more than the specified limit
128
      will be rejected. A value of less than 0 means no limit. If not specified,
129
      a default of 8192 is used.</p>
130
    </td></tr><tr id="Attributes_Standard Implementation_maxTrailerCount"><td><code class="attributeName">maxTrailerCount</code></td><td>
131
      <p>The maximum number of trailer headers in a request that is allowed by
132
      the container. A request that contains more trailer headers than the
133
      specified limit will be rejected. A value of less than 0 means no limit.
134
      If not specified, a default of 100 is used.</p>
135
    </td></tr><tr id="Attributes_Standard Implementation_maxTrailerSize"><td><code class="attributeName">maxTrailerSize</code></td><td>
136
      <p>The maximum total size for all trailer headers in a request that is
137
      allowed by the container. Total size for a header is calculated as the
138
      uncompressed size of the header name in bytes, plus the uncompressed size
139
      of the header value in bytes plus an HTTP/2 overhead of 3 bytes per
140
      header. A request that contains a set of trailer headers that requires
141
      more than the specified limit will be rejected. A value of less than 0
142
      means no limit. If not specified, a default of 8192 is used.</p>
143
    </td></tr><tr id="Attributes_Standard Implementation_noCompressionStrongETag"><td><code class="attributeName">noCompressionStrongETag</code></td><td>
144
      <p>This flag configures whether resources with a stong ETag will be
145
      considered for compression. If <code>true</code>, resources with a strong
146
      ETag will not be compressed. The default value is <code>true</code>.</p>
147
      <p>This attribute is deprecated. It will be removed in Tomcat 10 onwards
148
      where it will be hard-coded to <code>true</code>.</p>
149
    </td></tr><tr id="Attributes_Standard Implementation_noCompressionUserAgents"><td><code class="attributeName">noCompressionUserAgents</code></td><td>
150
      <p>The value is a regular expression (using <code>java.util.regex</code>)
151
      matching the <code>user-agent</code> header of HTTP clients for which
152
      compression should not be used,
153
      because these clients, although they do advertise support for the
154
      feature, have a broken implementation.
155
      The default value is an empty String (regexp matching disabled).</p>
156
    </td></tr><tr id="Attributes_Standard Implementation_overheadContinuationThreshold"><td><code class="attributeName">overheadContinuationThreshold</code></td><td>
157
      <p>The threshold below which the payload size of a non-final
158
      <code>CONTINUATION</code> frame will trigger an increase in the overhead
159
      count (see <strong>overheadCountFactor</strong>). The overhead count will
160
      be increased by <code>overheadContinuationThreshold/payloadSize</code> so
161
      that the smaller the <code>CONTINUATION</code> frame, the greater the
162
      increase in the overhead count. A value of zero or less disables the
163
      checking of non-final <code>CONTINUATION</code> frames. If not specified,
164
      a default value of <code>1024</code> will be used.</p>
165
    </td></tr><tr id="Attributes_Standard Implementation_overheadCountFactor"><td><code class="attributeName">overheadCountFactor</code></td><td>
166
      <p>The factor to apply when counting overhead frames to determine if a
167
      connection has too high an overhead and should be closed. The overhead
168
      count starts at <code>-10 * overheadCountFactor</code>. The count is
169
      decreased by 20 for each data frame sent or received and each headers frame
170
      received. The count is increased by the <code>overheadCountFactor</code>
171
      for each setting, priority, priority update and ping frame received. If
172
      the overhead count exceeds zero, the connection is closed. A value of less
173
      than <code>1</code> disables this protection. In normal usage a value of
174
      approximately <code>20</code> or higher will close the connection before
175
      any streams can complete. If not specified, a default value of
176
      <code>10</code> will be used.</p>
177
    </td></tr><tr id="Attributes_Standard Implementation_overheadResetFactor"><td><code class="attributeName">overheadResetFactor</code></td><td>
178
      <p>The amount by which the overhead count (see
179
      <strong>overheadCountFactor</strong>) will be increased for each reset
180
      frame received or sent. If not specified, a default value of
181
      <code>50</code> will be used. A value of less than zero will be treated as
182
      zero.</p>
183
    </td></tr><tr id="Attributes_Standard Implementation_overheadDataThreshold"><td><code class="attributeName">overheadDataThreshold</code></td><td>
184
      <p>The threshold below which the average payload size of the current and
185
      previous non-final <code>DATA</code> frames will trigger an increase in
186
      the overhead count (see <strong>overheadCountFactor</strong>). The
187
      overhead count will be increased by
188
      <code>overheadDataThreshold/average</code> so that the smaller the
189
      average, the greater the increase in the overhead count. A value of zero
190
      or less disables the checking of non-final <code>DATA</code> frames. If
191
      not specified, a default value of <code>1024</code> will be used.</p>
192
    </td></tr><tr id="Attributes_Standard Implementation_overheadWindowUpdateThreshold"><td><code class="attributeName">overheadWindowUpdateThreshold</code></td><td>
193
      <p>The threshold below which the average size of current and previous
194
      <code>WINDOW_UPDATE</code> frame will trigger an increase in the overhead
195
      count (see <strong>overheadCountFactor</strong>). The overhead count will
196
      be increased by <code>overheadWindowUpdateThreshold/average</code> so
197
      that the smaller the average, the greater the increase in the overhead
198
      count. A value of zero or less disables the checking of
199
      <code>WINDOW_UPDATE</code> frames. If not specified, a default value of
200
      <code>1024</code> will be used.</p>
201
    </td></tr><tr id="Attributes_Standard Implementation_readTimeout"><td><code class="attributeName">readTimeout</code></td><td>
202
      <p>The time, in milliseconds, that Tomcat will wait for additional data
203
      when a partial HTTP/2 frame has been received. Negative values will be
204
      treated as an infinite timeout. If not specified, a default value of
205
      <code>5000</code> will be used.</p>
206
    </td></tr><tr id="Attributes_Standard Implementation_streamReadTimeout"><td><code class="attributeName">streamReadTimeout</code></td><td>
207
      <p>The time, in milliseconds, that Tomcat will wait for additional data
208
      frames to arrive for the stream when an application is performing a
209
      blocking I/O read and additional data is required. Negative values will be
210
      treated as an infinite timeout. If not specified, a default value of
211
      <code>20000</code> will be used.</p>
212
    </td></tr><tr id="Attributes_Standard Implementation_streamWriteTimeout"><td><code class="attributeName">streamWriteTimeout</code></td><td>
213
      <p>The time, in milliseconds, that Tomcat will wait for additional window
214
      update frames to arrive for the stream and/or connection when an
215
      application is performing a blocking I/O write and the stream and/or
216
      connection flow control window is too small for the write to complete.
217
      Negative values will be treated as an infinite timeout. If not specified,
218
      a default value of <code>20000</code> will be used.</p>
219
    </td></tr><tr id="Attributes_Standard Implementation_useSendfile"><td><code class="attributeName">useSendfile</code></td><td>
220
      <p>Use this boolean attribute to enable or disable sendfile capability.
221
      The default value is <code>true</code>.</p>
222
      <p>This setting is ignored, and the sendfile capability disabled, if the
223
      <strong>useAsyncIO</strong> attribute of the associated
224
      <strong>Connector</strong> is set to <code>false</code>.</p>
225
      <p>The HTTP/2 sendfile capability uses <a href="https://docs.oracle.com/javase/8/docs/api/java/nio/MappedByteBuffer.html">MappedByteBuffer</a> which is known to cause file locking on Windows.</p>
226
    </td></tr><tr id="Attributes_Standard Implementation_writeTimeout"><td><code class="attributeName">writeTimeout</code></td><td>
227
      <p>The time, in milliseconds, that Tomcat will wait to write additional
228
      data when an HTTP/2 frame has been partially written. Negative values will
229
      be treated as an infinite timeout. If not specified, a default value of
230
      <code>5000</code> will be used.</p>
231
    </td></tr></table>
232
 
233
  <p>The HTTP/2 upgrade protocol will also inherit the following attributes from
234
  the <a href="http.html">HTTP Connector</a> within which it is nested:</p>
235
 
236
  <ul>
237
    <li>maxCookieCount</li>
238
    <li>maxParameterCount</li>
239
    <li>maxPartCount</li>
240
    <li>maxPartHeaderSize</li>
241
    <li>maxPostSize</li>
242
    <li>maxSavePostSize</li>
243
    <li>server</li>
244
    <li>serverRemoveAppProvidedValues</li>
245
  </ul>
246
 
247
  </div></div>
248
 
249
</div><h3 id="Nested_Components">Nested Components</h3><div class="text">
250
 
251
  <p>This component does not support any nested components.</p>
252
 
253
</div><h3 id="Special_Features">Special Features</h3><div class="text">
254
 
255
  <p>This component does not support any special features.</p>
256
 
257
</div></div></div></div></div><footer><div id="footer">
258
    Copyright &copy; 1999-2025, The Apache Software Foundation
259
    <br>
260
    Apache Tomcat, Tomcat, Apache, the Apache Tomcat logo and the Apache logo
261
    are either registered trademarks or trademarks of the Apache Software
262
    Foundation.
263
    </div></footer></div></body></html>