- Introduction
- Attributes
- Nested Components
- Special Features
- HTTP/1.1 and HTTP/1.0 Support
- HTTP/2 Support
- Proxy Support
- SSL Support
- SSL Support - SSLHostConfig
- SSL Support - Certificate
- SSL Support - Connector - NIO and NIO2
- SSL Support - OpenSSL's SSL_CONF API
- Key store types
- SSL Support - Connector - NIO and NIO2 (deprecated)
- SSL Support - Connector - APR/Native (deprecated)
- Connector Comparison
The HTTP Connector
Table of Contents
Introduction
The HTTP Connector element represents a Connector component that supports the HTTP/1.1 protocol. It enables Catalina to function as a stand-alone web server, in addition to its ability to execute servlets and JSP pages. A particular instance of this component listens for connections on a specific TCP port number on the server. One or more such Connectors can be configured as part of a single Service, each forwarding to the associated Engine to perform request processing and create the response.
If you wish to configure the Connector that is used
for connections to web servers using the AJP protocol (such as the
mod_jk 1.2.x
connector for Apache 1.3), please refer to the
AJP Connector documentation.
Each incoming, non-asynchronous request requires a thread for the duration
of that request. If more simultaneous requests are received than can be
handled by the currently available request processing threads, additional
threads will be created up to the configured maximum (the value of the
maxThreads
attribute). If still more simultaneous requests are
received, Tomcat will accept new connections until the current number of
connections reaches maxConnections
. Connections are queued inside
the server socket created by the Connector until a thread
becomes avaialble to process the connection. Once maxConnections
has been reached the operating system will queue further connections. The size
of the operating system provided connection queue may be controlled by the
acceptCount
attribute. If the operating system queue fills,
further connection requests may be refused or may time out.
Attributes
Common Attributes
All implementations of Connector support the following attributes:
Attribute | Description |
---|---|
allowTrace |
A boolean value which can be used to enable or disable the TRACE HTTP method. If not specified, this attribute is set to false. |
asyncTimeout |
The default timeout for asynchronous requests in milliseconds. If not specified, this attribute is set to the Servlet specification default of 30000 (30 seconds). |
discardFacades |
A boolean value which can be used to enable or disable the recycling
of the facade objects that isolate the container internal request
processing objects. If set to |
enableLookups |
Set to |
encodedSolidusHandling |
When set to |
maxCookieCount |
The maximum number of cookies that are permitted for a request. A value of less than zero means no limit. If not specified, a default value of 200 will be used. |
maxParameterCount |
The maximum number of parameter and value pairs (GET plus POST) which
will be automatically parsed by the container. Parameter and value pairs
beyond this limit will be ignored. A value of less than 0 means no limit.
If not specified, a default of 10000 is used. Note that
|
maxPostSize |
The maximum size in bytes of the POST which will be handled by
the container FORM URL parameter parsing. The limit can be disabled by
setting this attribute to a value less than zero. If not specified, this
attribute is set to 2097152 (2 megabytes). Note that the
|
maxSavePostSize |
The maximum size in bytes of the request body which will be saved/buffered by the container during FORM or CLIENT-CERT authentication or during HTTP/1.1 upgrade. For both types of authentication, the request body will be saved/buffered before the user is authenticated. For CLIENT-CERT authentication, the request body is buffered for the duration of the SSL handshake and the buffer emptied when the request is processed. For FORM authentication the POST is saved whilst the user is re-directed to the login form and is retained until the user successfully authenticates or the session associated with the authentication request expires. For HTTP/1.1 upgrade, the request body is buffered for the duration of the upgrade process. The limit can be disabled by setting this attribute to -1. Setting the attribute to zero will disable the saving of the requets body data during authentication and HTTP/1.1 upgrade. If not specified, this attribute is set to 4096 (4 kilobytes). |
parseBodyMethods |
A comma-separated list of HTTP methods for which request
bodies using |
port |
The TCP port number on which this Connector will create a server socket and await incoming connections. Your operating system will allow only one server application to listen to a particular port number on a particular IP address. If the special value of 0 (zero) is used, then Tomcat will select a free port at random to use for this connector. This is typically only useful in embedded and testing applications. |
protocol |
Sets the protocol to handle incoming traffic. The default value is
|
proxyName |
If this Connector is being used in a proxy
configuration, configure this attribute to specify the server name
to be returned for calls to |
proxyPort |
If this Connector is being used in a proxy
configuration, configure this attribute to specify the server port
to be returned for calls to |
redirectPort |
If this Connector is supporting non-SSL
requests, and a request is received for which a matching
|
scheme |
Set this attribute to the name of the protocol you wish to have
returned by calls to |
secure |
Set this attribute to |
URIEncoding |
This specifies the character encoding used to decode the URI bytes,
after %xx decoding the URL. If not specified, UTF-8 will be used unless
the |
useBodyEncodingForURI |
This specifies if the encoding specified in contentType should be used
for URI query parameters, instead of using the URIEncoding. This
setting is present for compatibility with Tomcat 4.1.x, where the
encoding specified in the contentType, or explicitly set using
Request.setCharacterEncoding method was also used for the parameters from
the URL. The default value is Notes: 1) This setting is applied only to the
query string of a request. Unlike |
useIPVHosts |
Set this attribute to |
xpoweredBy |
Set this attribute to |
Standard Implementation
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 |
acceptorThreadPriority |
The priority of the acceptor thread. The thread used to accept
new connections. The default value is |
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 |
allowHostHeaderMismatch |
By default Tomcat will allow requests that specify a host in the
request line but specify a different host in the host header. This
check can be enabled by setting this attribute to |
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. By default it
is bound when the connector is initiated and unbound when the connector is
destroyed. If set to |
clientCertProvider |
When client certificate information is presented in a form other than
instances of |
compressibleMimeType |
The value is a comma separated list of MIME types for which HTTP
compression may be used.
The default value is
|
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 Kb will be sent uncompressed.
You can turn off sendfile by setting |
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 |
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 |
connectionUploadTimeout |
Specifies the timeout, in milliseconds, to use while a data upload is
in progress. This only takes effect if
disableUploadTimeout is set to |
continueResponseTiming |
When to respond with a
|
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
|
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 |
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 |
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 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 |
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 KB). |
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 |
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 term |