The standard HTTP connectors (NIO, NIO2 and APR/native) all support the
following attributes in addition to the common Connector attributes listed
above.
|
Attribute
|
Description
|
|---|
acceptCount |
The maximum length of the operating system provided queue for incoming
connection requests when maxConnections has been reached. The
operating system may ignore this setting and use a different size for the
queue. When this queue is full, the operating system may actively refuse
additional connections or those connections may time out. The default
value is 100.
|
acceptorThreadPriority |
The priority of the acceptor thread. The thread used to accept
new connections. The default value is 5 (the value of the
java.lang.Thread.NORM_PRIORITY constant). See the JavaDoc
for the java.lang.Thread class for more details on what
this priority means.
|
address |
For servers with more than one IP address, this attribute specifies
which address will be used for listening on the specified port. By
default, the connector will listen all local addresses. Unless the JVM is
configured otherwise using system properties, the Java based connectors
(NIO, NIO2) will listen on both IPv4 and IPv6 addresses when configured
with either 0.0.0.0 or ::. The APR/native
connector will only listen on IPv4 addresses if configured with
0.0.0.0 and will listen on IPv6 addresses (and optionally
IPv4 addresses depending on the setting of ipv6v6only) if
configured with ::.
|
allowHostHeaderMismatch |
By default Tomcat will reject requests that specify a host in the
request line but specify a different host in the host header. This
check can be disabled by setting this attribute to true. If
not specified, the default is false.
This setting will be removed in Tomcat 11 onwards where it will be
hard-coded to false.
|
allowedTrailerHeaders |
By default Tomcat will ignore all trailer headers when processing
chunked input. For a header to be processed, it must be added to this
comma-separated list of header names.
|
bindOnInit |
Controls when the socket used by the connector is bound. If set to
true it is bound when the connector is initiated and unbound
when the connector is destroyed. If set to false, the socket
will be bound when the connector is started and unbound when it is
stopped. If not specified, the default is true.
|
clientCertProvider |
When client certificate information is presented in a form other than
instances of java.security.cert.X509Certificate it needs to
be converted before it can be used and this property controls which JSSE
provider is used to perform the conversion. For example it is used with
the AJP connectors, the HTTP APR connector and
with the
org.apache.catalina.valves.SSLValve. If not specified, the default
provider will be used.
|
compressibleMimeType |
The value is a comma separated list of MIME types for which HTTP
compression may be used.
The default value is
text/html,text/xml,text/plain,text/css,text/javascript,application/javascript,application/json,application/xml
.
If you specify a type explicitly, the default is over-ridden.
|
compression |
The Connector may use HTTP/1.1 GZIP compression in
an attempt to save server bandwidth. The acceptable values for the
parameter is "off" (disable compression), "on" (allow compression, which
causes text data to be compressed), "force" (forces compression in all
cases), or a numerical integer value (which is equivalent to "on", but
specifies the minimum amount of data before the output is compressed). If
the content-length is not known and compression is set to "on" or more
aggressive, the output will also be compressed. If not specified, this
attribute is set to "off".
Note: There is a tradeoff between using compression (saving
your bandwidth) and using the sendfile feature (saving your CPU cycles).
If the connector supports the sendfile feature, e.g. the NIO connector,
using sendfile will take precedence over compression. The symptoms will
be that static files greater that 48 KiB will be sent uncompressed.
You can turn off sendfile by setting useSendfile attribute
of the connector, as documented below, or change the sendfile usage
threshold in the configuration of the
DefaultServlet in the default
conf/web.xml or in the web.xml of your web
application.
|
compressionMinSize |
If compression is set to "on" then this attribute
may be used to specify the minimum amount of data before the output is
compressed. If not specified, this attribute is defaults to "2048".
Units are in bytes.
|
connectionLinger |
The number of seconds during which the sockets used by this
Connector will linger when they are closed. The default
value is -1 which disables socket linger.
|
connectionTimeout |
The number of milliseconds this Connector will wait,
after accepting a connection, for the request URI line to be
presented. Use a value of -1 to indicate no (i.e. infinite) timeout.
The default value is 60000 (i.e. 60 seconds) but note that the standard
server.xml that ships with Tomcat sets this to 20000 (i.e. 20 seconds).
Unless disableUploadTimeout is set to false,
this timeout will also be used when reading the request body (if any).
|
connectionUploadTimeout |
Specifies the timeout, in milliseconds, to use while a data upload is
in progress. If not specified the default
value is 300000 (i.e. 300 seconds). This only takes effect if
disableUploadTimeout is set to false.
|
continueResponseTiming |
When to respond with a 100 intermediate response code to a
request containing an Expect: 100-continue header.
The following values may used:
immediately - an intermediate 100 status response
will be returned as soon as practical
onRead - an intermediate 100 status
response will be returned only when the Servlet reads the request body,
allowing the servlet to inspect the headers and possibly respond
before the user agent sends a possibly large request body.
|
defaultSSLHostConfigName |
The name of the default SSLHostConfig that will be
used for secure connections (if this connector is configured for secure
connections) if the client connection does not provide SNI or if the SNI
is provided but does not match any configured
SSLHostConfig. If not specified the default value of
_default_ will be used. Provided values are always converted
to lower case.
|
disableUploadTimeout |
This flag allows the servlet container to use a different, usually
longer connection timeout during data upload. If not specified, this
attribute is set to true which disables this longer timeout.
|
executor |
A reference to the name in an Executor
element. If this attribute is set, and the named executor exists, the
connector will use the executor, and all the other thread attributes will
be ignored. Note that if a shared executor is not specified for a
connector then the connector will use a private, internal executor to
provide the thread pool.
|
executorTerminationTimeoutMillis |
The time that the private internal executor will wait for request
processing threads to terminate before continuing with the process of
stopping the connector. If not set, the default is 5000 (5
seconds).
|
keepAliveTimeout |
The number of milliseconds this Connector will wait
for another HTTP request before closing the connection. The default value
is to use the value that has been set for the
connectionTimeout attribute.
Use a value of -1 to indicate no (i.e. infinite) timeout.
|
maxConnections |
The maximum number of connections that the server will accept and
process at any given time. When this number has been reached, the server
will accept, but not process, one further connection. This additional
connection be blocked until the number of connections being processed
falls below maxConnections at which point the server will
start accepting and processing new connections again. Note that once the
limit has been reached, the operating system may still accept connections
based on the acceptCount setting. The default value
is 8192.
For NIO/NIO2 only, setting the value to -1, will disable the
maxConnections feature and connections will not be counted.
|
maxExtensionSize |
Limits the total length of chunk extensions in chunked HTTP requests.
If the value is -1, no limit will be imposed. If not
specified, the default value of 8192 will be used.
|
maxHeaderCount |
The maximum number of headers in a request that are allowed by the
container. A request that contains more headers than the specified limit
will be rejected. A value of less than 0 means no limit.
If not specified, a default of 100 is used.
|
maxHttpHeaderSize |
Provides the default value for
maxHttpRequestHeaderSize and
maxHttpResponseHeaderSize. If not specified, this
attribute is set to 8192 (8 KiB).
|
maxHttpRequestHeaderSize |
The maximum permitted size of the request line and headers associated
with an HTTP request, specified in bytes. This is compared to the number
of bytes received so includes line terminators and whitespace as well as
the request line, header names and header values. If not specified, this
attribute is set to the value of the maxHttpHeaderSize
attribute.
If you see "Request header is too large" errors you can increase this,
but be aware that Tomcat will allocate the full amount you specify for
every request. For example, if you specify a maxHttpRequestHeaderSize of
1 MB and your application handles 100 concurrent requests, you will see
100 MB of heap consumed by request headers.
|
maxHttpResponseHeaderSize |
The maximum permitted size of the response line and headers associated
with an HTTP response, specified in bytes. This is compared to the number
of bytes written so includes line terminators and whitespace as well as
the status line, header names and header values. If not specified, this
attribute is set to the value of the maxHttpHeaderSize
attribute.
|
maxKeepAliveRequests |
The maximum number of HTTP requests which can be pipelined until
the connection is closed by the server. Setting this attribute to 1 will
disable HTTP/1.0 keep-alive, as well as HTTP/1.1 keep-alive and
pipelining. Setting this to -1 will allow an unlimited amount of
pipelined or keep-alive HTTP requests.
If not specified, this attribute is set to 100.
|
maxQueueSize |
(int) The maximum number of runnable tasks that can queue up awaiting
execution before they are rejected. The default value is
Integer.MAX_VALUE
|
maxSwallowSize |
The maximum number of request body bytes (excluding transfer encoding
overhead) that will be swallowed by Tomcat for an aborted upload. An
aborted upload is when Tomcat knows that the request body is going to be
ignored but the client still sends it. If Tomcat does not swallow the body
the client is unlikely to see the response. If not specified the default
of 2097152 (2 MiB) will be used. A value of less than zero indicates
that no limit should be enforced.
|
maxThreads |
The maximum number of request processing threads to be created
by this Connector, which therefore determines the
maximum number of simultaneous requests that can be handled. If
not specified, this attribute is set to 200. If an executor is associated
with this connector, this attribute is ignored as the connector will
execute tasks using the executor rather than an internal thread pool. Note
that if an executor is configured any value set for this attribute will be
recorded correctly but it will be reported (e.g. via JMX) as
-1 to make clear that it is not used.
|
maxTrailerSize |
Limits the total length of trailing headers in the last chunk of
a chunked HTTP request. This must be a positive integer value.
If not specified, the default value of 8192 will be
used.
|
minSpareThreads |
The minimum number of threads always kept running. This includes both
active and idle threads. If not specified, the default of 10
is used. If an executor is associated with this connector, this attribute
is ignored as the connector will execute tasks using the executor rather
than an internal thread pool. Note that if an executor is configured any
value set for this attribute will be recorded correctly but it will be
reported (e.g. via JMX) as -1 to make clear that it is not
used.
|
noCompressionStrongETag |
This flag configures whether resources with a strong ETag will be
considered for compression. If true, resources with a strong
ETag will not be compressed. The default value is true.
This attribute is deprecated. It will be removed in Tomcat 10 onwards
where it will be hard-coded to true.
|
noCompressionUserAgents |
The value is a regular expression (using java.util.regex)
matching the user-agent header of HTTP clients for which
compression should not be used,
because these clients, although they do advertise support for the
feature, have a broken implementation.
The default value is an empty String (regexp matching disabled).
|
processorCache |
The protocol handler caches Processor objects to speed up performance.
This setting dictates how many of these objects get cached.
-1 means unlimited, default is 200.
0 means no request processor reuse. This has a very
significant impact on performance and garbage collection depending on
the workload, but provides additional security guarantees by avoiding
reuse of all request processing objects.
If not using Servlet 3.0 asynchronous processing, an appropriate value
is to use the same as the maxThreads setting. If using Servlet 3.0
asynchronous processing, an appropriate value is to use the larger
of maxThreads and the maximum number of expected concurrent requests
(synchronous and asynchronous).
|
rejectIllegalHeader |
If an HTTP request is received that contains an illegal header name or
value (e.g. the header name is not a token) this setting determines if the
request will be rejected with a 400 response (true) or if the
illegal header be ignored (false). The default value is
true which will cause the request to be rejected.
This setting will be removed in Tomcat 11 onwards where it will be
hard-coded to true.
|
rejectIllegalHeaderName |
This attribute is deprecated. It will be removed in Tomcat 10 onwards.
It is now an alias for rejectIllegalHeader.
|
relaxedPathChars |
The HTTP/1.1
specification requires that certain characters are %nn encoded when
used in URI paths. Unfortunately, many user agents including all the major
browsers are not compliant with this specification and use these
characters in unencoded form. To prevent Tomcat rejecting such requests,
this attribute may be used to specify the additional characters to allow.
If not specified, no additional characters will be allowed. The value may
be any combination of the following characters:
" < > [ \ ] ^ ` { | } . Any other characters
present in the value will be ignored.
|
relaxedQueryChars |
The HTTP/1.1
specification requires that certain characters are %nn encoded when
used in URI query strings. Unfortunately, many user agents including all
the major browsers are not compliant with this specification and use these
characters in unencoded form. To prevent Tomcat rejecting such requests,
this attribute may be used to specify the additional characters to allow.
If not specified, no additional characters will be allowed. The value may
be any combination of the following characters:
" < > [ \ ] ^ ` { | } . Any other characters
present in the value will be ignored.
|
restrictedUserAgents |
The value is a regular expression (using java.util.regex)
matching the user-agent header of HTTP clients for which
HTTP/1.1 or HTTP/1.0 keep alive should not be used, even if the clients
advertise support for these features.
The default value is an empty String (regexp matching disabled).
|
server |
Overrides the Server header for the http response. If set, the value
for this attribute overrides any Server header set by a web application.
If not set, any value specified by the application is used. If the
application does not specify a value then no Server header is set.
|
serverRemoveAppProvidedValues |
If true, any Server header set by a web
application will be removed. Note that if server is set,
this attribute is effectively ignored. If not set, the default value of
false will be used.
|
SSLEnabled |
Use this attribute to enable SSL traffic on a connector.
To turn on SSL handshake/encryption/decryption on a connector
set this value to true.
The default value is false.
When turning this value true you will want to set the
scheme and the secure attributes as well
to pass the correct request.getScheme() and
request.isSecure() values to the servlets
See SSL Support for more information.
|
tcpNoDelay |
If set to true, the TCP_NO_DELAY option will be
set on the server socket, which improves performance under most
circumstances. This is set to true by default.
|
threadPriority |
The priority of the request processing threads within the JVM.
The default value is 5 (the value of the
java.lang.Thread.NORM_PRIORITY constant). See the JavaDoc
for the java.lang.Thread class for more details on what
this priority means. If an executor is associated
with this connector, this attribute is ignored as the connector will
execute tasks using the executor rather than an internal thread pool. Note
that if an executor is configured any value set for this attribute will be
recorded correctly but it will be reported (e.g. via JMX) as
-1 to make clear that it is not used.
|
threadsMaxIdleTime |
The amount of time in milliseconds that threads will be kept alive by
the thread pool, if there are more than minSpareThreads
threads in the executor. If not specified, the default of
60000 milliseconds is used. If an executor is associated
with this connector, this attribute
is ignored as the connector will execute tasks using the executor rather
than an internal thread pool. Note that if an executor is configured any
value set for this attribute will be recorded correctly but it will be
reported (e.g. via JMX) as -1 to make clear that it is not
used.
|
throwOnFailure |
If the Connector experiences an Exception during a Lifecycle transition
should the Exception be rethrown or logged? If not specified, the default
of false will be used. Note that the default can be changed
by the org.apache.catalina.startup.EXIT_ON_INIT_FAILURE
system property.
|
useAsyncIO |
(bool) Use this attribute to enable or disable usage of the
asynchronous IO API. The default value is true except when
using the APR connector due to low performance.
|
useKeepAliveResponseHeader |
(bool) Use this attribute to enable or disable the addition of the
Keep-Alive HTTP response header as described in
this
Internet-Draft. The default value is true.
|
useVirtualThreads |
(bool) Use this attribute to enable or disable usage of virtual threads
with the internal executor. If an executor is associated with this
connector, this attribute is ignored. The default value is
false.
|