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 AJP Connector</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 AJP Connector</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_Implementations">Standard Implementations</a></li><li><a href="#Java_TCP_socket_attributes">Java TCP socket attributes</a></li><li><a href="#NIO_specific_configuration">NIO specific configuration</a></li><li><a href="#NIO2_specific_configuration">NIO2 specific configuration</a></li><li><a href="#APR/native_specific_configuration">APR/native specific configuration</a></li></ol></li><li><a href="#Nested_Components">Nested Components</a></li><li><a href="#Special_Features">Special Features</a><ol><li><a href="#Proxy_Support">Proxy Support</a></li><li><a href="#Connector_Comparison">Connector Comparison</a></li></ol></li></ul> |
||
| 6 | </div><h3 id="Introduction">Introduction</h3><div class="text"> |
||
| 7 | |||
| 8 | <p>The <strong>AJP Connector</strong> element represents a |
||
| 9 | <strong>Connector</strong> component that communicates with a web |
||
| 10 | connector via the <code>AJP</code> protocol. This is used for cases |
||
| 11 | where you wish to invisibly integrate Tomcat into an existing (or new) |
||
| 12 | Apache installation, and you want Apache to handle the static content |
||
| 13 | contained in the web application, and/or utilize Apache's SSL |
||
| 14 | processing.</p> |
||
| 15 | |||
| 16 | <p>Use of the AJP protocol requires additional security considerations because |
||
| 17 | it allows greater direct manipulation of Tomcat's internal data structures |
||
| 18 | than the HTTP connectors. Particular attention should be paid to the values |
||
| 19 | used for the <code>address</code>, <code>secret</code>, |
||
| 20 | <code>secretRequired</code> and <code>allowedRequestAttributesPattern</code> |
||
| 21 | attributes.</p> |
||
| 22 | |||
| 23 | <p>This connector supports load balancing when used in conjunction with |
||
| 24 | the <code>jvmRoute</code> attribute of the |
||
| 25 | <a href="engine.html">Engine</a>.</p> |
||
| 26 | |||
| 27 | <p>The native connectors supported with this Tomcat release are:</p> |
||
| 28 | <ul> |
||
| 29 | <li>JK 1.2.x with any of the supported servers. See |
||
| 30 | <a href="https://tomcat.apache.org/connectors-doc/">the JK docs</a> |
||
| 31 | for details.</li> |
||
| 32 | <li>mod_proxy on Apache httpd 2.x (included by default in Apache HTTP |
||
| 33 | Server 2.2), with AJP enabled: see |
||
| 34 | <a href="https://httpd.apache.org/docs/2.2/mod/mod_proxy_ajp.html">the |
||
| 35 | httpd docs</a> for details.</li> |
||
| 36 | </ul> |
||
| 37 | |||
| 38 | <p><b>Other native connectors supporting AJP may work, but are no longer |
||
| 39 | supported.</b></p> |
||
| 40 | |||
| 41 | </div><h3 id="Attributes">Attributes</h3><div class="text"> |
||
| 42 | |||
| 43 | <div class="subsection"><h4 id="Common_Attributes">Common Attributes</h4><div class="text"> |
||
| 44 | |||
| 45 | <p>All implementations of <strong>Connector</strong> |
||
| 46 | support the following attributes:</p> |
||
| 47 | |||
| 48 | <table class="defaultTable"><tr><th style="width: 15%;"> |
||
| 49 | Attribute |
||
| 50 | </th><th style="width: 85%;"> |
||
| 51 | Description |
||
| 52 | </th></tr><tr id="Attributes_Common Attributes_allowTrace"><td><code class="attributeName">allowTrace</code></td><td> |
||
| 53 | <p>A boolean value which can be used to enable or disable the TRACE |
||
| 54 | HTTP method. If not specified, this attribute is set to false. As per RFC |
||
| 55 | 7231 section 4.3.8, cookie and authorization headers will be excluded from |
||
| 56 | the response to the TRACE request. If you wish to include these, you can |
||
| 57 | implement the <code>doTrace()</code> method for the target Servlet and |
||
| 58 | gain full control over the response.</p> |
||
| 59 | </td></tr><tr id="Attributes_Common Attributes_asyncTimeout"><td><code class="attributeName">asyncTimeout</code></td><td> |
||
| 60 | <p>The default timeout for asynchronous requests in milliseconds. If not |
||
| 61 | specified, this attribute is set to the Servlet specification default of |
||
| 62 | 30000 (30 seconds).</p> |
||
| 63 | </td></tr><tr id="Attributes_Common Attributes_discardFacades"><td><code class="attributeName">discardFacades</code></td><td> |
||
| 64 | <p>A boolean value which can be used to enable or disable the recycling |
||
| 65 | of the facade objects that isolate the container internal request |
||
| 66 | processing objects. If set to <code>true</code> the facades will be |
||
| 67 | set for garbage collection after every request, otherwise they will be |
||
| 68 | reused. This setting has no effect when the security manager is enabled. |
||
| 69 | If not specified, this attribute is set to <code>true</code>.</p> |
||
| 70 | </td></tr><tr id="Attributes_Common Attributes_enableLookups"><td><code class="attributeName">enableLookups</code></td><td> |
||
| 71 | <p>Set to <code>true</code> if you want calls to |
||
| 72 | <code>request.getRemoteHost()</code> to perform DNS lookups in |
||
| 73 | order to return the actual host name of the remote client. Set |
||
| 74 | to <code>false</code> to skip the DNS lookup and return the IP |
||
| 75 | address in String form instead (thereby improving performance). |
||
| 76 | By default, DNS lookups are disabled.</p> |
||
| 77 | </td></tr><tr id="Attributes_Common Attributes_encodedReverseSolidusHandling"><td><code class="attributeName">encodedReverseSolidusHandling</code></td><td> |
||
| 78 | <p>When set to <code>reject</code> request paths containing a |
||
| 79 | <code>%5c</code> sequence will be rejected with a 400 response. When set |
||
| 80 | to <code>decode</code> request paths containing a <code>%5c</code> |
||
| 81 | sequence will have that sequence decoded to <code>\</code> at the same |
||
| 82 | time other <code>%nn</code> sequences are decoded. When set to |
||
| 83 | <code>passthrough</code> request paths containing a <code>%5c</code> |
||
| 84 | sequence will be processed with the <code>%5c</code> sequence unchanged. |
||
| 85 | </p> |
||
| 86 | <p>When set to <code>decoded</code>, the <strong>allowBackslash</strong> |
||
| 87 | attribute will be applied after decoding. |
||
| 88 | </p> |
||
| 89 | <p>If <code>passthrough</code> is used then it is the application's |
||
| 90 | responsibility to perform any further <code>%nn</code> decoding required. |
||
| 91 | Any <code>%25</code> sequences (encoded <code>%</code>) in the request |
||
| 92 | path with also be processed with the <code>%25</code> sequence unchanged |
||
| 93 | to avoid potential corruption and/or decoding failure when the path is |
||
| 94 | subsequently <code>%nn</code> decoded by the application.</p> |
||
| 95 | <p>If not specified, the default value is <code>decode</code>.</p> |
||
| 96 | </td></tr><tr id="Attributes_Common Attributes_encodedSolidusHandling"><td><code class="attributeName">encodedSolidusHandling</code></td><td> |
||
| 97 | <p>When set to <code>reject</code> request paths containing a |
||
| 98 | <code>%2f</code> sequence will be rejected with a 400 response. When set |
||
| 99 | to <code>decode</code> request paths containing a <code>%2f</code> |
||
| 100 | sequence will have that sequence decoded to <code>/</code> at the same |
||
| 101 | time other <code>%nn</code> sequences are decoded. When set to |
||
| 102 | <code>passthrough</code> request paths containing a <code>%2f</code> |
||
| 103 | sequence will be processed with the <code>%2f</code> sequence unchanged. |
||
| 104 | </p> |
||
| 105 | <p>If <code>passthrough</code> is used then it is the application's |
||
| 106 | responsibility to perform any further <code>%nn</code> decoding required. |
||
| 107 | Any <code>%25</code> sequences (encoded <code>%</code>) in the request |
||
| 108 | path with also be processed with the <code>%25</code> sequence unchanged |
||
| 109 | to avoid potential corruption and/or decoding failure when the path is |
||
| 110 | subsequently <code>%nn</code> decoded by the application.</p> |
||
| 111 | <p>If not specified the default value is <code>reject</code>. This default |
||
| 112 | may be modified if the deprecated <a href="systemprops.html">system |
||
| 113 | property</a> |
||
| 114 | <code>org.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH</code> is |
||
| 115 | set.</p> |
||
| 116 | </td></tr><tr id="Attributes_Common Attributes_maxCookieCount"><td><code class="attributeName">maxCookieCount</code></td><td> |
||
| 117 | <p>The maximum number of cookies that are permitted for a request. A value |
||
| 118 | of less than zero means no limit. If not specified, a default value of 200 |
||
| 119 | will be used.</p> |
||
| 120 | </td></tr><tr id="Attributes_Common Attributes_maxParameterCount"><td><code class="attributeName">maxParameterCount</code></td><td> |
||
| 121 | <p>The maximum total number of request parameters (including uploaded |
||
| 122 | files) obtained from the query string and, for POST requests, the request |
||
| 123 | body if the content type is |
||
| 124 | <code>application/x-www-form-urlencoded</code> or |
||
| 125 | <code>multipart/form-data</code>. Request parameters beyond this limit |
||
| 126 | will be ignored. A value of less than 0 means no limit. If not specified, |
||
| 127 | a default of 10000 is used. The <code>FailedRequestFilter</code> |
||
| 128 | <a href="filter.html">filter</a> can be used to reject requests that |
||
| 129 | exceed the limit.</p> |
||
| 130 | </td></tr><tr id="Attributes_Common Attributes_maxPartCount"><td><code class="attributeName">maxPartCount</code></td><td> |
||
| 131 | <p>The maximum total number of parts permitted in a request where the |
||
| 132 | content type is <code>multipart/form-data</code>. This limit is in |
||
| 133 | addition to <code>maxParameterCount</code>. A value of less than 0 means |
||
| 134 | no limit. If not specified, a default of 50 is used. Requests that exceed |
||
| 135 | this limit may be ignored depending on how the application processes the |
||
| 136 | request. The <code>FailedRequestFilter</code> |
||
| 137 | <a href="filter.html">filter</a> can be used to always reject requests |
||
| 138 | that exceed the limit.</p> |
||
| 139 | <p>The nature of multipart requests and the associated Servlet API |
||
| 140 | requirements for processing them is such that they can place a significant |
||
| 141 | demand on memory. Applications utilising multipart requests need to ensure |
||
| 142 | sufficient memory is available to avoid a potential denial of service. As |
||
| 143 | a guide, the memory required is <code>maxPartHeaderSize</code> x |
||
| 144 | <code>maxPartCount</code> x <code>maxConnections</code> x 2 (due to the |
||
| 145 | implementation). For the defaults that is <code>512 x 50 x 8192 x 2</code> |
||
| 146 | which is 400MB. If running on Java 8, this is increased by a further |
||
| 147 | factor of 2 due to the way Java stores Strings internally which increases |
||
| 148 | the default memory requirements to 800MB.</p> |
||
| 149 | </td></tr><tr id="Attributes_Common Attributes_maxPartHeaderSize"><td><code class="attributeName">maxPartHeaderSize</code></td><td> |
||
| 150 | <p>The maximum number of header bytes permitted per part in a request |
||
| 151 | where the content type is <code>multipart/form-data</code>. Requests that |
||
| 152 | exceed this limit will be rejected. A value of less than 0 means no limit. |
||
| 153 | If not specified, a default of 512 is used.</p> |
||
| 154 | </td></tr><tr id="Attributes_Common Attributes_maxPostSize"><td><code class="attributeName">maxPostSize</code></td><td> |
||
| 155 | <p>This is the maximum number of request body bytes that will be converted |
||
| 156 | into request parameters by Tomcat. This limit only applies in specific |
||
| 157 | circumstances and is <strong>not</strong> a general limit on request body |
||
| 158 | size for POST requests. The limit only applies when Tomcat is processing |
||
| 159 | the request body for parameters as per section 3.1.1 |
||
| 160 | (<code>application/x-www-form-urlencoded</code>) or section 3.2 |
||
| 161 | (<code>multipart/form-data</code>) of the Servlet specification. In the |
||
| 162 | <code>multipart/form-data</code> case, the limit only applies to the data |
||
| 163 | used to generate the parameters that are made available through the |
||
| 164 | <code>getParameter()</code> family of methods.</p> |
||
| 165 | <p>The limit can be disabled by setting this attribute to a value less |
||
| 166 | than zero. If not specified, this attribute is set to 2097152 (2 MiB). |
||
| 167 | Note that the |
||
| 168 | <a href="filter.html#Failed_Request_Filter"><code>FailedRequestFilter</code></a> |
||
| 169 | can be used to reject requests that exceed this limit.</p> |
||
| 170 | </td></tr><tr id="Attributes_Common Attributes_maxSavePostSize"><td><code class="attributeName">maxSavePostSize</code></td><td> |
||
| 171 | <p>The maximum size in bytes of the POST which will be saved/buffered by |
||
| 172 | the container during FORM or CLIENT-CERT authentication. For both types |
||
| 173 | of authentication, the POST will be saved/buffered before the user is |
||
| 174 | authenticated. For CLIENT-CERT authentication, the POST is buffered for |
||
| 175 | the duration of the SSL handshake and the buffer emptied when the request |
||
| 176 | is processed. For FORM authentication the POST is saved whilst the user |
||
| 177 | is re-directed to the login form and is retained until the user |
||
| 178 | successfully authenticates or the session associated with the |
||
| 179 | authentication request expires. The limit can be disabled by setting this |
||
| 180 | attribute to -1. Setting the attribute to zero will disable the saving of |
||
| 181 | POST data during authentication. If not specified, this attribute is set |
||
| 182 | to 4096 (4 KiB).</p> |
||
| 183 | </td></tr><tr id="Attributes_Common Attributes_parseBodyMethods"><td><code class="attributeName">parseBodyMethods</code></td><td> |
||
| 184 | <p>A comma-separated list of HTTP methods for which request |
||
| 185 | bodies using <code>application/x-www-form-urlencoded</code> will be parsed |
||
| 186 | for request parameters identically to POST. This is useful in RESTful |
||
| 187 | applications that want to support POST-style semantics for PUT requests. |
||
| 188 | Note that any setting other than <code>POST</code> causes Tomcat |
||
| 189 | to behave in a way that goes against the intent of the servlet |
||
| 190 | specification. |
||
| 191 | The HTTP method TRACE is specifically forbidden here in accordance |
||
| 192 | with the HTTP specification. |
||
| 193 | The default is <code>POST</code></p> |
||
| 194 | </td></tr><tr id="Attributes_Common Attributes_port"><td><strong><code class="attributeName">port</code></strong></td><td> |
||
| 195 | <p>The TCP port number on which this <strong>Connector</strong> |
||
| 196 | will create a server socket and await incoming connections. Your |
||
| 197 | operating system will allow only one server application to listen |
||
| 198 | to a particular port number on a particular IP address. If the special |
||
| 199 | value of 0 (zero) is used, then Tomcat will select a free port at random |
||
| 200 | to use for this connector. This is typically only useful in embedded and |
||
| 201 | testing applications.</p> |
||
| 202 | </td></tr><tr id="Attributes_Common Attributes_protocol"><td><code class="attributeName">protocol</code></td><td> |
||
| 203 | <p>Sets the protocol to handle incoming traffic. To configure an AJP |
||
| 204 | connector this must be specified. If no value for protocol is provided, |
||
| 205 | an <a href="http.html">HTTP connector</a> rather than an AJP connector |
||
| 206 | will be configured.<br> |
||
| 207 | The standard protocol value for an AJP connector is <code>AJP/1.3</code> |
||
| 208 | which uses an auto-switching mechanism to select either a Java NIO based |
||
| 209 | connector or an APR/native based connector. If the |
||
| 210 | <code>PATH</code> (Windows) or <code>LD_LIBRARY_PATH</code> (on most unix |
||
| 211 | systems) environment variables contain the Tomcat native library, the |
||
| 212 | native/APR connector will be used. If the native library cannot be |
||
| 213 | found, the Java NIO based connector will be used.<br> |
||
| 214 | To use an explicit protocol rather than rely on the auto-switching |
||
| 215 | mechanism described above, the following values may be used:<br> |
||
| 216 | <code>org.apache.coyote.ajp.AjpNioProtocol</code> |
||
| 217 | - non blocking Java NIO connector.<br> |
||
| 218 | <code>org.apache.coyote.ajp.AjpNio2Protocol</code> |
||
| 219 | - non blocking Java NIO2 connector.<br> |
||
| 220 | <code>org.apache.coyote.ajp.AjpAprProtocol</code> |
||
| 221 | - the APR/native connector.<br> |
||
| 222 | Custom implementations may also be used.<br> |
||
| 223 | Take a look at our <a href="#Connector_Comparison">Connector |
||
| 224 | Comparison</a> chart. |
||
| 225 | </p> |
||
| 226 | </td></tr><tr id="Attributes_Common Attributes_proxyName"><td><code class="attributeName">proxyName</code></td><td> |
||
| 227 | <p>If this <strong>Connector</strong> is being used in a proxy |
||
| 228 | configuration, configure this attribute to specify the server name |
||
| 229 | to be returned for calls to <code>request.getServerName()</code>. |
||
| 230 | See <a href="#Proxy_Support">Proxy Support</a> for more |
||
| 231 | information.</p> |
||
| 232 | </td></tr><tr id="Attributes_Common Attributes_proxyPort"><td><code class="attributeName">proxyPort</code></td><td> |
||
| 233 | <p>If this <strong>Connector</strong> is being used in a proxy |
||
| 234 | configuration, configure this attribute to specify the server port |
||
| 235 | to be returned for calls to <code>request.getServerPort()</code>. |
||
| 236 | See <a href="#Proxy_Support">Proxy Support</a> for more |
||
| 237 | information.</p> |
||
| 238 | </td></tr><tr id="Attributes_Common Attributes_redirectPort"><td><code class="attributeName">redirectPort</code></td><td> |
||
| 239 | <p>If this <strong>Connector</strong> is supporting non-SSL |
||
| 240 | requests, and a request is received for which a matching |
||
| 241 | <code><security-constraint></code> requires SSL transport, |
||
| 242 | Catalina will automatically redirect the request to the port |
||
| 243 | number specified here.</p> |
||
| 244 | </td></tr><tr id="Attributes_Common Attributes_scheme"><td><code class="attributeName">scheme</code></td><td> |
||
| 245 | <p>Set this attribute to the name of the protocol you wish to have |
||
| 246 | returned by calls to <code>request.getScheme()</code>. For |
||
| 247 | example, you would set this attribute to "<code>https</code>" |
||
| 248 | for an SSL Connector. The default value is "<code>http</code>". |
||
| 249 | </p> |
||
| 250 | </td></tr><tr id="Attributes_Common Attributes_secure"><td><code class="attributeName">secure</code></td><td> |
||
| 251 | <p>Set this attribute to <code>true</code> if you wish to have |
||
| 252 | calls to <code>request.isSecure()</code> to return <code>true</code> |
||
| 253 | for requests received by this Connector. You would want this on an |
||
| 254 | SSL Connector or a non SSL connector that is receiving data from a |
||
| 255 | SSL accelerator, like a crypto card, an SSL appliance or even a webserver. |
||
| 256 | The default value is <code>false</code>.</p> |
||
| 257 | </td></tr><tr id="Attributes_Common Attributes_URIEncoding"><td><code class="attributeName">URIEncoding</code></td><td> |
||
| 258 | <p>This specifies the character encoding used to decode the URI bytes, |
||
| 259 | after %xx decoding the URL. The default value is <code>UTF-8</code>.</p> |
||
| 260 | </td></tr><tr id="Attributes_Common Attributes_useBodyEncodingForURI"><td><code class="attributeName">useBodyEncodingForURI</code></td><td> |
||
| 261 | <p>This specifies if the encoding specified in contentType should be used |
||
| 262 | for URI query parameters, instead of using the URIEncoding. This |
||
| 263 | setting is present for compatibility with Tomcat 4.1.x, where the |
||
| 264 | encoding specified in the contentType, or explicitly set using |
||
| 265 | Request.setCharacterEncoding method was also used for the parameters from |
||
| 266 | the URL. The default value is <code>false</code>. |
||
| 267 | </p> |
||
| 268 | <p><em>Notes:</em> See notes on this attribute in |
||
| 269 | <a href="http.html">HTTP Connector</a> documentation.</p> |
||
| 270 | </td></tr><tr id="Attributes_Common Attributes_useIPVHosts"><td><code class="attributeName">useIPVHosts</code></td><td> |
||
| 271 | <p>Set this attribute to <code>true</code> to cause Tomcat to use |
||
| 272 | the IP address passed by the native web server to determine the Host |
||
| 273 | to send the request to. The default value is <code>false</code>.</p> |
||
| 274 | </td></tr><tr id="Attributes_Common Attributes_xpoweredBy"><td><code class="attributeName">xpoweredBy</code></td><td> |
||
| 275 | <p>Set this attribute to <code>true</code> to cause Tomcat to advertise |
||
| 276 | support for the Servlet specification using the header recommended in the |
||
| 277 | specification. The default value is <code>false</code>.</p> |
||
| 278 | </td></tr></table> |
||
| 279 | |||
| 280 | </div></div> |
||
| 281 | |||
| 282 | <div class="subsection"><h4 id="Standard_Implementations">Standard Implementations</h4><div class="text"> |
||
| 283 | |||
| 284 | <p>To use AJP, you must specify the protocol attribute (see above).</p> |
||
| 285 | |||
| 286 | <p>The standard AJP connectors (NIO, NIO2 and APR/native) all support the |
||
| 287 | following attributes in addition to the common Connector attributes listed |
||
| 288 | above.</p> |
||
| 289 | |||
| 290 | <table class="defaultTable"><tr><th style="width: 15%;"> |
||
| 291 | Attribute |
||
| 292 | </th><th style="width: 85%;"> |
||
| 293 | Description |
||
| 294 | </th></tr><tr id="Attributes_Standard Implementations_acceptCount"><td><code class="attributeName">acceptCount</code></td><td> |
||
| 295 | <p>The maximum length of the operating system provided queue for incoming |
||
| 296 | connection requests when <code>maxConnections</code> has been reached. The |
||
| 297 | operating system may ignore this setting and use a different size for the |
||
| 298 | queue. When this queue is full, the operating system may actively refuse |
||
| 299 | additional connections or those connections may time out. The default |
||
| 300 | value is 100.</p> |
||
| 301 | </td></tr><tr id="Attributes_Standard Implementations_acceptorThreadCount"><td><code class="attributeName">acceptorThreadCount</code></td><td> |
||
| 302 | <p>The number of threads to be used to accept connections. Increase this |
||
| 303 | value on a multi CPU machine, although you would never really need more |
||
| 304 | than <code>2</code>. Also, with a lot of non keep alive connections, you |
||
| 305 | might want to increase this value as well. Default value is |
||
| 306 | <code>1</code>.</p> |
||
| 307 | </td></tr><tr id="Attributes_Standard Implementations_acceptorThreadPriority"><td><code class="attributeName">acceptorThreadPriority</code></td><td> |
||
| 308 | <p>The priority of the acceptor threads. The threads used to accept |
||
| 309 | new connections. The default value is <code>5</code> (the value of the |
||
| 310 | <code>java.lang.Thread.NORM_PRIORITY</code> constant). See the JavaDoc |
||
| 311 | for the <code>java.lang.Thread</code> class for more details on what |
||
| 312 | this priority means.</p> |
||
| 313 | </td></tr><tr id="Attributes_Standard Implementations_address"><td><code class="attributeName">address</code></td><td> |
||
| 314 | <p>For servers with more than one IP address, this attribute specifies |
||
| 315 | which address will be used for listening on the specified port. By |
||
| 316 | default, the connector will listen on the loopback address. Unless the JVM |
||
| 317 | is configured otherwise using system properties, the Java based connectors |
||
| 318 | (NIO, NIO2) will listen on both IPv4 and IPv6 addresses when configured |
||
| 319 | with either <code>0.0.0.0</code> or <code>::</code>. The APR/native |
||
| 320 | connector will only listen on IPv4 addresses if configured with |
||
| 321 | <code>0.0.0.0</code> and will listen on IPv6 addresses (and optionally |
||
| 322 | IPv4 addresses depending on the setting of <strong>ipv6v6only</strong>) if |
||
| 323 | configured with <code>::</code>.</p> |
||
| 324 | </td></tr><tr id="Attributes_Standard Implementations_ajpFlush"><td><code class="attributeName">ajpFlush</code></td><td> |
||
| 325 | <p>A boolean value which can be used to enable or disable sending |
||
| 326 | AJP flush messages to the fronting proxy whenever an explicit |
||
| 327 | flush happens. The default value is <code>true</code>.<br> |
||
| 328 | An AJP flush message is a SEND_BODY_CHUNK packet with no body content. |
||
| 329 | Proxy implementations like mod_jk or mod_proxy_ajp will flush the |
||
| 330 | data buffered in the web server to the client when they receive |
||
| 331 | such a packet. Setting this to <code>false</code> can reduce |
||
| 332 | AJP packet traffic but might delay sending packets to the client. |
||
| 333 | At the end of the response, AJP does always flush to the client.</p> |
||
| 334 | </td></tr><tr id="Attributes_Standard Implementations_allowedRequestAttributesPattern"><td><code class="attributeName">allowedRequestAttributesPattern</code></td><td> |
||
| 335 | <p>The AJP protocol passes some information from the reverse proxy to the |
||
| 336 | AJP connector using request attributes. These attributes are:</p> |
||
| 337 | <ul> |
||
| 338 | <li>javax.servlet.request.cipher_suite</li> |
||
| 339 | <li>javax.servlet.request.key_size</li> |
||
| 340 | <li>javax.servlet.request.ssl_session</li> |
||
| 341 | <li>javax.servlet.request.X509Certificate</li> |
||
| 342 | <li>AJP_LOCAL_ADDR</li> |
||
| 343 | <li>AJP_REMOTE_PORT</li> |
||
| 344 | <li>AJP_SSL_PROTOCOL</li> |
||
| 345 | <li>JK_LB_ACTIVATION</li> |
||
| 346 | <li>CERT_ISSUER (IIS only)</li> |
||
| 347 | <li>CERT_SUBJECT (IIS only)</li> |
||
| 348 | <li>CERT_COOKIE (IIS only)</li> |
||
| 349 | <li>HTTPS_SERVER_SUBJECT (IIS only)</li> |
||
| 350 | <li>CERT_FLAGS (IIS only)</li> |
||
| 351 | <li>HTTPS_SECRETKEYSIZE (IIS only)</li> |
||
| 352 | <li>CERT_SERIALNUMBER (IIS only)</li> |
||
| 353 | <li>HTTPS_SERVER_ISSUER (IIS only)</li> |
||
| 354 | <li>HTTPS_KEYSIZE (IIS only)</li> |
||
| 355 | </ul> |
||
| 356 | <p>The AJP protocol supports the passing of arbitrary request attributes. |
||
| 357 | Requests containing arbitrary request attributes will be rejected with a |
||
| 358 | 403 response unless the entire attribute name matches this regular |
||
| 359 | expression. If not specified, the default value is <code>null</code>.</p> |
||
| 360 | </td></tr><tr id="Attributes_Standard Implementations_bindOnInit"><td><code class="attributeName">bindOnInit</code></td><td> |
||
| 361 | <p>Controls when the socket used by the connector is bound. If set to |
||
| 362 | <code>true</code> it is bound when the connector is initiated and unbound |
||
| 363 | when the connector is destroyed. If set to <code>false</code>, the socket |
||
| 364 | will be bound when the connector is started and unbound when it is |
||
| 365 | stopped. If not specified, the default is <code>true</code>.</p> |
||
| 366 | </td></tr><tr id="Attributes_Standard Implementations_clientCertProvider"><td><code class="attributeName">clientCertProvider</code></td><td> |
||
| 367 | <p>When client certificate information is presented in a form other than |
||
| 368 | instances of <code>java.security.cert.X509Certificate</code> it needs to |
||
| 369 | be converted before it can be used and this property controls which JSSE |
||
| 370 | provider is used to perform the conversion. For example it is used with |
||
| 371 | the AJP connectors, the <a href="http.html">HTTP APR connector</a> and |
||
| 372 | with the <a href="valve.html#SSL_Authenticator_Valve"> |
||
| 373 | org.apache.catalina.valves.SSLValve</a>.If not specified, the default |
||
| 374 | provider will be used.</p> |
||
| 375 | </td></tr><tr id="Attributes_Standard Implementations_connectionLinger"><td><code class="attributeName">connectionLinger</code></td><td> |
||
| 376 | <p>The number of seconds during which the sockets used by this |
||
| 377 | <strong>Connector</strong> will linger when they are closed. The default |
||
| 378 | value is <code>-1</code> which disables socket linger.</p> |
||
| 379 | </td></tr><tr id="Attributes_Standard Implementations_connectionTimeout"><td><code class="attributeName">connectionTimeout</code></td><td> |
||
| 380 | <p>The number of milliseconds this <strong>Connector</strong> will wait, |
||
| 381 | after accepting a connection, for the request URI line to be |
||
| 382 | presented. The default value for AJP protocol connectors |
||
| 383 | is <code>-1</code> (i.e. infinite).</p> |
||
| 384 | </td></tr><tr id="Attributes_Standard Implementations_executor"><td><code class="attributeName">executor</code></td><td> |
||
| 385 | <p>A reference to the name in an <a href="executor.html">Executor</a> |
||
| 386 | element. If this attribute is set, and the named executor exists, the |
||
| 387 | connector will use the executor, and all the other thread attributes will |
||
| 388 | be ignored. Note that if a shared executor is not specified for a |
||
| 389 | connector then the connector will use a private, internal executor to |
||
| 390 | provide the thread pool.</p> |
||
| 391 | </td></tr><tr id="Attributes_Standard Implementations_executorTerminationTimeoutMillis"><td><code class="attributeName">executorTerminationTimeoutMillis</code></td><td> |
||
| 392 | <p>The time that the private internal executor will wait for request |
||
| 393 | processing threads to terminate before continuing with the process of |
||
| 394 | stopping the connector. If not set, the default is <code>5000</code> (5 |
||
| 395 | seconds).</p> |
||
| 396 | </td></tr><tr id="Attributes_Standard Implementations_keepAliveTimeout"><td><code class="attributeName">keepAliveTimeout</code></td><td> |
||
| 397 | <p>The number of milliseconds this <strong>Connector</strong> will wait for |
||
| 398 | another AJP request before closing the connection. |
||
| 399 | The default value is to use the value that has been set for the |
||
| 400 | connectionTimeout attribute.</p> |
||
| 401 | </td></tr><tr id="Attributes_Standard Implementations_maxConnections"><td><code class="attributeName">maxConnections</code></td><td> |
||
| 402 | <p>The maximum number of connections that the server will accept and |
||
| 403 | process at any given time. When this number has been reached, the server |
||
| 404 | will accept, but not process, one further connection. This additional |
||
| 405 | connection be blocked until the number of connections being processed |
||
| 406 | falls below <strong>maxConnections</strong> at which point the server will |
||
| 407 | start accepting and processing new connections again. Note that once the |
||
| 408 | limit has been reached, the operating system may still accept connections |
||
| 409 | based on the <code>acceptCount</code> setting. The default value |
||
| 410 | is <code>8192</code>.</p> |
||
| 411 | <p>For NIO/NIO2 only, setting the value to -1, will disable the |
||
| 412 | maxConnections feature and connections will not be counted.</p> |
||
| 413 | </td></tr><tr id="Attributes_Standard Implementations_maxHeaderCount"><td><code class="attributeName">maxHeaderCount</code></td><td> |
||
| 414 | <p>The maximum number of headers in a request that are allowed by the |
||
| 415 | container. A request that contains more headers than the specified limit |
||
| 416 | will be rejected. A value of less than 0 means no limit. |
||
| 417 | If not specified, a default of 100 is used.</p> |
||
| 418 | </td></tr><tr id="Attributes_Standard Implementations_maxThreads"><td><code class="attributeName">maxThreads</code></td><td> |
||
| 419 | <p>The maximum number of request processing threads to be created |
||
| 420 | by this <strong>Connector</strong>, which therefore determines the |
||
| 421 | maximum number of simultaneous requests that can be handled. If |
||
| 422 | not specified, this attribute is set to 200. If an executor is associated |
||
| 423 | with this connector, this attribute is ignored as the connector will |
||
| 424 | execute tasks using the executor rather than an internal thread pool. Note |
||
| 425 | that if an executor is configured any value set for this attribute will be |
||
| 426 | recorded correctly but it will be reported (e.g. via JMX) as |
||
| 427 | <code>-1</code> to make clear that it is not used.</p> |
||
| 428 | </td></tr><tr id="Attributes_Standard Implementations_minSpareThreads"><td><code class="attributeName">minSpareThreads</code></td><td> |
||
| 429 | <p>The minimum number of threads always kept running. This includes both |
||
| 430 | active and idle threads. If not specified, the default of <code>10</code> |
||
| 431 | is used. If an executor is associated with this connector, this attribute |
||
| 432 | is ignored as the connector will execute tasks using the executor rather |
||
| 433 | than an internal thread pool. Note that if an executor is configured any |
||
| 434 | value set for this attribute will be recorded correctly but it will be |
||
| 435 | reported (e.g. via JMX) as <code>-1</code> to make clear that it is not |
||
| 436 | used.</p> |
||
| 437 | </td></tr><tr id="Attributes_Standard Implementations_packetSize"><td><code class="attributeName">packetSize</code></td><td> |
||
| 438 | <p>This attribute sets the maximum AJP packet size in Bytes. The maximum |
||
| 439 | value is 65536. It should be the same as the <code>max_packet_size</code> |
||
| 440 | directive configured for mod_jk. Normally it is not necessary to change |
||
| 441 | the maximum packet size. Problems with the default value have been |
||
| 442 | reported when sending certificates or certificate chains. The default |
||
| 443 | value is 8192. If set to less than 8192 then the setting will ignored and |
||
| 444 | the default value of 8192 used.</p> |
||
| 445 | </td></tr><tr id="Attributes_Standard Implementations_processorCache"><td><code class="attributeName">processorCache</code></td><td> |
||
| 446 | <p>The protocol handler caches Processor objects to speed up performance. |
||
| 447 | This setting dictates how many of these objects get cached. |
||
| 448 | <code>-1</code> means unlimited, default is <code>200</code>. If not using |
||
| 449 | Servlet 3.0 asynchronous processing, a good default is to use the same as |
||
| 450 | the maxThreads setting. If using Servlet 3.0 asynchronous processing, a |
||
| 451 | good default is to use the larger of maxThreads and the maximum number of |
||
| 452 | expected concurrent requests (synchronous and asynchronous).</p> |
||
| 453 | </td></tr><tr id="Attributes_Standard Implementations_secret"><td><code class="attributeName">secret</code></td><td> |
||
| 454 | <p>Only requests from workers with this secret keyword will be accepted. |
||
| 455 | The default value is <code>null</code>. This attribute must be specified |
||
| 456 | with a non-null, non-zero length value unless |
||
| 457 | <strong>secretRequired</strong> is explicitly configured to be |
||
| 458 | <code>false</code>. If this attribute is configured with a non-null, |
||
| 459 | non-zero length value then the workers <strong>must</strong> provide a |
||
| 460 | matching value else the request will be rejected irrespective of the |
||
| 461 | setting of <strong>secretRequired</strong>.</p> |
||
| 462 | </td></tr><tr id="Attributes_Standard Implementations_secretRequired"><td><code class="attributeName">secretRequired</code></td><td> |
||
| 463 | <p>If this attribute is <code>true</code>, the AJP Connector will only |
||
| 464 | start if the <strong>secret</strong> attribute is configured with a |
||
| 465 | non-null, non-zero length value. This attribute only controls whether |
||
| 466 | the <strong>secret</strong> attribute is required to be specified for the |
||
| 467 | AJP Connector to start. It <strong>does not</strong> control whether |
||
| 468 | workers are required to provide the secret. The default value is |
||
| 469 | <code>true</code>. This attribute should only be set to <code>false</code> |
||
| 470 | when the Connector is used on a trusted network.</p> |
||
| 471 | </td></tr><tr id="Attributes_Standard Implementations_tcpNoDelay"><td><code class="attributeName">tcpNoDelay</code></td><td> |
||
| 472 | <p>If set to <code>true</code>, the TCP_NO_DELAY option will be |
||
| 473 | set on the server socket, which improves performance under most |
||
| 474 | circumstances. This is set to <code>true</code> by default.</p> |
||
| 475 | </td></tr><tr id="Attributes_Standard Implementations_threadPriority"><td><code class="attributeName">threadPriority</code></td><td> |
||
| 476 | <p>The priority of the request processing threads within the JVM. |
||
| 477 | The default value is <code>5</code> (the value of the |
||
| 478 | <code>java.lang.Thread.NORM_PRIORITY</code> constant). See the JavaDoc |
||
| 479 | for the <code>java.lang.Thread</code> class for more details on what |
||
| 480 | this priority means.If an executor is associated |
||
| 481 | with this connector, this attribute is ignored as the connector will |
||
| 482 | execute tasks using the executor rather than an internal thread pool. Note |
||
| 483 | that if an executor is configured any value set for this attribute will be |
||
| 484 | recorded correctly but it will be reported (e.g. via JMX) as |
||
| 485 | <code>-1</code> to make clear that it is not used.</p> |
||
| 486 | </td></tr><tr id="Attributes_Standard Implementations_throwOnFailure"><td><code class="attributeName">throwOnFailure</code></td><td> |
||
| 487 | <p>If the Connector experiences an Exception during a Lifecycle transition |
||
| 488 | should the Exception be rethrown or logged? If not specified, the default |
||
| 489 | of <code>false</code> will be used. Note that the default can be changed |
||
| 490 | by the <code>org.apache.catalina.startup.EXIT_ON_INIT_FAILURE</code> |
||
| 491 | system property.</p> |
||
| 492 | </td></tr><tr id="Attributes_Standard Implementations_tomcatAuthentication"><td><code class="attributeName">tomcatAuthentication</code></td><td> |
||
| 493 | <p>If set to <code>true</code>, the authentication will be done in Tomcat. |
||
| 494 | Otherwise, the authenticated principal will be propagated from the native |
||
| 495 | webserver and used for authorization in Tomcat. </p> |
||
| 496 | <p>The web server must send the user principal (username) as a request |
||
| 497 | <i>attribute</i> named <code>REMOTE_USER</code>.</p> |
||
| 498 | <p>Note that this principal will have no roles associated with it.</p> |
||
| 499 | <p>The default value is <code>true</code>. If |
||
| 500 | <code>tomcatAuthorization</code> is set to <code>true</code> this |
||
| 501 | attribute has no effect.</p> |
||
| 502 | </td></tr><tr id="Attributes_Standard Implementations_tomcatAuthorization"><td><code class="attributeName">tomcatAuthorization</code></td><td> |
||
| 503 | <p>If set to <code>true</code>, the authenticated principal will be |
||
| 504 | propagated from the native webserver and considered already authenticated |
||
| 505 | in Tomcat. If the web application has one or more security constraints, |
||
| 506 | authorization will then be performed by Tomcat and roles assigned to the |
||
| 507 | authenticated principal. If the appropriate Tomcat Realm for the request |
||
| 508 | does not recognise the provided user name, a Principal will be still be |
||
| 509 | created but it will have no roles. The default value is |
||
| 510 | <code>false</code>.</p> |
||
| 511 | </td></tr><tr id="Attributes_Standard Implementations_useVirtualThreads"><td><code class="attributeName">useVirtualThreads</code></td><td> |
||
| 512 | <p>(bool) Use this attribute to enable or disable usage of virtual threads |
||
| 513 | with the internal executor. If an executor is associated with this |
||
| 514 | connector, this attribute is ignored. The default value is |
||
| 515 | <code>false</code>.</p> |
||
| 516 | </td></tr></table> |
||
| 517 | |||
| 518 | </div></div> |
||
| 519 | |||
| 520 | <div class="subsection"><h4 id="Java_TCP_socket_attributes">Java TCP socket attributes</h4><div class="text"> |
||
| 521 | |||
| 522 | <p>The NIO and NIO2 implementation support the following Java TCP socket |
||
| 523 | attributes in addition to the common Connector and HTTP attributes listed |
||
| 524 | above.</p> |
||
| 525 | |||
| 526 | <table class="defaultTable"><tr><th style="width: 15%;"> |
||
| 527 | Attribute |
||
| 528 | </th><th style="width: 85%;"> |
||
| 529 | Description |
||
| 530 | </th></tr><tr id="Attributes_Java TCP socket attributes_socket.rxBufSize"><td><code class="attributeName">socket.rxBufSize</code></td><td> |
||
| 531 | <p>(int)The socket receive buffer (SO_RCVBUF) size in bytes. JVM default |
||
| 532 | used if not set.</p> |
||
| 533 | </td></tr><tr id="Attributes_Java TCP socket attributes_socket.txBufSize"><td><code class="attributeName">socket.txBufSize</code></td><td> |
||
| 534 | <p>(int)The socket send buffer (SO_SNDBUF) size in bytes. JVM default |
||
| 535 | used if not set. Care should be taken if explicitly setting this value. |
||
| 536 | Very poor performance has been observed on some JVMs with values less |
||
| 537 | than ~8k.</p> |
||
| 538 | </td></tr><tr id="Attributes_Java TCP socket attributes_socket.tcpNoDelay"><td><code class="attributeName">socket.tcpNoDelay</code></td><td> |
||
| 539 | <p>(bool)This is equivalent to standard attribute |
||
| 540 | <strong>tcpNoDelay</strong>.</p> |
||
| 541 | </td></tr><tr id="Attributes_Java TCP socket attributes_socket.soKeepAlive"><td><code class="attributeName">socket.soKeepAlive</code></td><td> |
||
| 542 | <p>(bool)Boolean value for the socket's keep alive setting |
||
| 543 | (SO_KEEPALIVE). JVM default used if not set.</p> |
||
| 544 | </td></tr><tr id="Attributes_Java TCP socket attributes_socket.ooBInline"><td><code class="attributeName">socket.ooBInline</code></td><td> |
||
| 545 | <p>(bool)Boolean value for the socket OOBINLINE setting. JVM default |
||
| 546 | used if not set.</p> |
||
| 547 | </td></tr><tr id="Attributes_Java TCP socket attributes_socket.soReuseAddress"><td><code class="attributeName">socket.soReuseAddress</code></td><td> |
||
| 548 | <p>(bool)Boolean value for the sockets reuse address option |
||
| 549 | (SO_REUSEADDR). JVM default used if not set.</p> |
||
| 550 | </td></tr><tr id="Attributes_Java TCP socket attributes_socket.soLingerOn"><td><code class="attributeName">socket.soLingerOn</code></td><td> |
||
| 551 | <p>(bool)Boolean value for the sockets so linger option (SO_LINGER). |
||
| 552 | A value for the standard attribute <strong>connectionLinger</strong> |
||
| 553 | that is >=0 is equivalent to setting this to <code>true</code>. |
||
| 554 | A value for the standard attribute <strong>connectionLinger</strong> |
||
| 555 | that is <0 is equivalent to setting this to <code>false</code>. |
||
| 556 | Both this attribute and <code>soLingerTime</code> must be set else the |
||
| 557 | JVM defaults will be used for both.</p> |
||
| 558 | </td></tr><tr id="Attributes_Java TCP socket attributes_socket.soLingerTime"><td><code class="attributeName">socket.soLingerTime</code></td><td> |
||
| 559 | <p>(int)Value in seconds for the sockets so linger option (SO_LINGER). |
||
| 560 | This is equivalent to standard attribute |
||
| 561 | <strong>connectionLinger</strong>. |
||
| 562 | Both this attribute and <code>soLingerOn</code> must be set else the |
||
| 563 | JVM defaults will be used for both.</p> |
||
| 564 | </td></tr><tr id="Attributes_Java TCP socket attributes_socket.soTimeout"><td><code class="attributeName">socket.soTimeout</code></td><td> |
||
| 565 | <p>This is equivalent to standard attribute |
||
| 566 | <strong>connectionTimeout</strong>.</p> |
||
| 567 | </td></tr><tr id="Attributes_Java TCP socket attributes_socket.performanceConnectionTime"><td><code class="attributeName">socket.performanceConnectionTime</code></td><td> |
||
| 568 | <p>(int)The first value for the performance settings. See |
||
| 569 | <a href="https://docs.oracle.com/javase/8/docs/api/java/net/Socket.html#setPerformancePreferences(int,%20int,%20int)">Socket Performance Options</a> |
||
| 570 | All three performance attributes must be set else the JVM defaults will |
||
| 571 | be used for all three.</p> |
||
| 572 | </td></tr><tr id="Attributes_Java TCP socket attributes_socket.performanceLatency"><td><code class="attributeName">socket.performanceLatency</code></td><td> |
||
| 573 | <p>(int)The second value for the performance settings. See |
||
| 574 | <a href="https://docs.oracle.com/javase/8/docs/api/java/net/Socket.html#setPerformancePreferences(int,%20int,%20int)">Socket Performance Options</a> |
||
| 575 | All three performance attributes must be set else the JVM defaults will |
||
| 576 | be used for all three.</p> |
||
| 577 | </td></tr><tr id="Attributes_Java TCP socket attributes_socket.performanceBandwidth"><td><code class="attributeName">socket.performanceBandwidth</code></td><td> |
||
| 578 | <p>(int)The third value for the performance settings. See |
||
| 579 | <a href="https://docs.oracle.com/javase/8/docs/api/java/net/Socket.html#setPerformancePreferences(int,%20int,%20int)">Socket Performance Options</a> |
||
| 580 | All three performance attributes must be set else the JVM defaults will |
||
| 581 | be used for all three.</p> |
||
| 582 | </td></tr><tr id="Attributes_Java TCP socket attributes_socket.unlockTimeout"><td><code class="attributeName">socket.unlockTimeout</code></td><td> |
||
| 583 | <p>(int) The timeout for a socket unlock. When a connector is stopped, it will try to release the acceptor thread by opening a connector to itself. |
||
| 584 | The default value is <code>250</code> and the value is in milliseconds</p> |
||
| 585 | </td></tr></table> |
||
| 586 | </div></div> |
||
| 587 | |||
| 588 | <div class="subsection"><h4 id="NIO_specific_configuration">NIO specific configuration</h4><div class="text"> |
||
| 589 | |||
| 590 | <p>The following attributes are specific to the NIO connector.</p> |
||
| 591 | |||
| 592 | <table class="defaultTable"><tr><th style="width: 15%;"> |
||
| 593 | Attribute |
||
| 594 | </th><th style="width: 85%;"> |
||
| 595 | Description |
||
| 596 | </th></tr><tr id="Attributes_NIO specific configuration_socket.directBuffer"><td><code class="attributeName">socket.directBuffer</code></td><td> |
||
| 597 | <p>(bool)Boolean value, whether to use direct ByteBuffers or java mapped |
||
| 598 | ByteBuffers. Default is <code>false</code>.<br> |
||
| 599 | When you are using direct buffers, make sure you allocate the |
||
| 600 | appropriate amount of memory for the direct memory space. On Sun's JDK |
||
| 601 | that would be something like <code>-XX:MaxDirectMemorySize=256m</code>. |
||
| 602 | </p> |
||
| 603 | </td></tr><tr id="Attributes_NIO specific configuration_socket.appReadBufSize"><td><code class="attributeName">socket.appReadBufSize</code></td><td> |
||
| 604 | <p>(int)Each connection that is opened up in Tomcat get associated with |
||
| 605 | a read ByteBuffer. This attribute controls the size of this buffer. By |
||
| 606 | default this read buffer is sized at <code>8192</code> bytes. For lower |
||
| 607 | concurrency, you can increase this to buffer more data. For an extreme |
||
| 608 | amount of keep alive connections, decrease this number or increase your |
||
| 609 | heap size.</p> |
||
| 610 | </td></tr><tr id="Attributes_NIO specific configuration_socket.appWriteBufSize"><td><code class="attributeName">socket.appWriteBufSize</code></td><td> |
||
| 611 | <p>(int)Each connection that is opened up in Tomcat get associated with |
||
| 612 | a write ByteBuffer. This attribute controls the size of this buffer. By |
||
| 613 | default this write buffer is sized at <code>8192</code> bytes. For low |
||
| 614 | concurrency you can increase this to buffer more response data. For an |
||
| 615 | extreme amount of keep alive connections, decrease this number or |
||
| 616 | increase your heap size.<br> |
||
| 617 | The default value here is pretty low, you should up it if you are not |
||
| 618 | dealing with tens of thousands concurrent connections.</p> |
||
| 619 | </td></tr><tr id="Attributes_NIO specific configuration_socket.bufferPool"><td><code class="attributeName">socket.bufferPool</code></td><td> |
||
| 620 | <p>(int)The NIO connector uses a class called NioChannel that holds |
||
| 621 | elements linked to a socket. To reduce garbage collection, the NIO |
||
| 622 | connector caches these channel objects. This value specifies the size of |
||
| 623 | this cache. The default value is <code>500</code>, and represents that |
||
| 624 | the cache will hold 500 NioChannel objects. Other values are |
||
| 625 | <code>-1</code> for unlimited cache and <code>0</code> for no cache.</p> |
||
| 626 | </td></tr><tr id="Attributes_NIO specific configuration_socket.bufferPoolSize"><td><code class="attributeName">socket.bufferPoolSize</code></td><td> |
||
| 627 | <p>(int)The NioChannel pool can also be size based, not used object |
||
| 628 | based. The size is calculated as follows:<br> |
||
| 629 | NioChannel |
||
| 630 | <code>buffer size = read buffer size + write buffer size</code><br> |
||
| 631 | SecureNioChannel <code>buffer size = application read buffer size + |
||
| 632 | application write buffer size + network read buffer size + |
||
| 633 | network write buffer size</code><br> |
||
| 634 | The value is in bytes, the default value is <code>1024*1024*100</code> |
||
| 635 | (100 MiB).</p> |
||
| 636 | </td></tr><tr id="Attributes_NIO specific configuration_socket.processorCache"><td><code class="attributeName">socket.processorCache</code></td><td> |
||
| 637 | <p>(int)Tomcat will cache SocketProcessor objects to reduce garbage |
||
| 638 | collection. The integer value specifies how many objects to keep in the |
||
| 639 | cache at most. The default is <code>500</code>. Other values are |
||
| 640 | <code>-1</code> for unlimited cache and <code>0</code> for no cache.</p> |
||
| 641 | </td></tr><tr id="Attributes_NIO specific configuration_socket.keyCache"><td><code class="attributeName">socket.keyCache</code></td><td> |
||
| 642 | <p>(int)Tomcat will cache KeyAttachment objects to reduce garbage |
||
| 643 | collection. The integer value specifies how many objects to keep in the |
||
| 644 | cache at most. The default is <code>500</code>. Other values are |
||
| 645 | <code>-1</code> for unlimited cache and <code>0</code> for no cache.</p> |
||
| 646 | </td></tr><tr id="Attributes_NIO specific configuration_socket.eventCache"><td><code class="attributeName">socket.eventCache</code></td><td> |
||
| 647 | <p>(int)Tomcat will cache PollerEvent objects to reduce garbage |
||
| 648 | collection. The integer value specifies how many objects to keep in the |
||
| 649 | cache at most. The default is <code>500</code>. Other values are |
||
| 650 | <code>-1</code> for unlimited cache and <code>0</code> for no cache.</p> |
||
| 651 | </td></tr></table> |
||
| 652 | </div></div> |
||
| 653 | |||
| 654 | <div class="subsection"><h4 id="NIO2_specific_configuration">NIO2 specific configuration</h4><div class="text"> |
||
| 655 | |||
| 656 | <p>The following attributes are specific to the NIO2 connector.</p> |
||
| 657 | |||
| 658 | <table class="defaultTable"><tr><th style="width: 15%;"> |
||
| 659 | Attribute |
||
| 660 | </th><th style="width: 85%;"> |
||
| 661 | Description |
||
| 662 | </th></tr><tr id="Attributes_NIO2 specific configuration_useCaches"><td><code class="attributeName">useCaches</code></td><td> |
||
| 663 | <p>(bool)Use this attribute to enable or disable object caching to |
||
| 664 | reduce the amount of GC objects produced. |
||
| 665 | The default value is <code>false</code>.</p> |
||
| 666 | </td></tr><tr id="Attributes_NIO2 specific configuration_socket.directBuffer"><td><code class="attributeName">socket.directBuffer</code></td><td> |
||
| 667 | <p>(bool)Boolean value, whether to use direct ByteBuffers or java mapped |
||
| 668 | ByteBuffers. Default is <code>false</code>.<br> |
||
| 669 | When you are using direct buffers, make sure you allocate the |
||
| 670 | appropriate amount of memory for the direct memory space. On Sun's JDK |
||
| 671 | that would be something like <code>-XX:MaxDirectMemorySize=256m</code>. |
||
| 672 | </p> |
||
| 673 | </td></tr><tr id="Attributes_NIO2 specific configuration_socket.appReadBufSize"><td><code class="attributeName">socket.appReadBufSize</code></td><td> |
||
| 674 | <p>(int)Each connection that is opened up in Tomcat get associated with |
||
| 675 | a read ByteBuffer. This attribute controls the size of this buffer. By |
||
| 676 | default this read buffer is sized at <code>8192</code> bytes. For lower |
||
| 677 | concurrency, you can increase this to buffer more data. For an extreme |
||
| 678 | amount of keep alive connections, decrease this number or increase your |
||
| 679 | heap size.</p> |
||
| 680 | </td></tr><tr id="Attributes_NIO2 specific configuration_socket.appWriteBufSize"><td><code class="attributeName">socket.appWriteBufSize</code></td><td> |
||
| 681 | <p>(int)Each connection that is opened up in Tomcat get associated with |
||
| 682 | a write ByteBuffer. This attribute controls the size of this buffer. By |
||
| 683 | default this write buffer is sized at <code>8192</code> bytes. For low |
||
| 684 | concurrency you can increase this to buffer more response data. For an |
||
| 685 | extreme amount of keep alive connections, decrease this number or |
||
| 686 | increase your heap size.<br> |
||
| 687 | The default value here is pretty low, you should up it if you are not |
||
| 688 | dealing with tens of thousands concurrent connections.</p> |
||
| 689 | </td></tr><tr id="Attributes_NIO2 specific configuration_socket.bufferPoolSize"><td><code class="attributeName">socket.bufferPoolSize</code></td><td> |
||
| 690 | <p>(int)The NIO2 connector uses a class called Nio2Channel that holds |
||
| 691 | elements linked to a socket. To reduce garbage collection, the NIO |
||
| 692 | connector caches these channel objects. This value specifies the size of |
||
| 693 | this cache. The default value is <code>500</code>, and represents that |
||
| 694 | the cache will hold 500 Nio2Channel objects. Other values are |
||
| 695 | <code>-1</code> for unlimited cache and <code>0</code> for no cache.</p> |
||
| 696 | </td></tr><tr id="Attributes_NIO2 specific configuration_socket.processorCache"><td><code class="attributeName">socket.processorCache</code></td><td> |
||
| 697 | <p>(int)Tomcat will cache SocketProcessor objects to reduce garbage |
||
| 698 | collection. The integer value specifies how many objects to keep in the |
||
| 699 | cache at most. The default is <code>500</code>. Other values are |
||
| 700 | <code>-1</code> for unlimited cache and <code>0</code> for no cache.</p> |
||
| 701 | </td></tr></table> |
||
| 702 | </div></div> |
||
| 703 | |||
| 704 | <div class="subsection"><h4 id="APR/native_specific_configuration">APR/native specific configuration</h4><div class="text"> |
||
| 705 | |||
| 706 | <p>The APR/native implementation supports the following attributes in |
||
| 707 | addition to the common Connector and AJP attributes listed above.</p> |
||
| 708 | |||
| 709 | <table class="defaultTable"><tr><th style="width: 15%;"> |
||
| 710 | Attribute |
||
| 711 | </th><th style="width: 85%;"> |
||
| 712 | Description |
||
| 713 | </th></tr><tr id="Attributes_APR/native specific configuration_ipv6v6only"><td><code class="attributeName">ipv6v6only</code></td><td> |
||
| 714 | <p>If listening on an IPv6 address on a dual stack system, should the |
||
| 715 | connector only listen on the IPv6 address? If not specified the default |
||
| 716 | is <code>false</code> and the connector will listen on the IPv6 address |
||
| 717 | and the equivalent IPv4 address if present.</p> |
||
| 718 | </td></tr><tr id="Attributes_APR/native specific configuration_pollTime"><td><code class="attributeName">pollTime</code></td><td> |
||
| 719 | <p>Duration of a poll call in microseconds. Lowering this value will |
||
| 720 | slightly decrease latency of connections being kept alive in some cases |
||
| 721 | , but will use more CPU as more poll calls are being made. The default |
||
| 722 | value is 2000 (2ms). |
||
| 723 | </p> |
||
| 724 | </td></tr></table> |
||
| 725 | |||
| 726 | </div></div> |
||
| 727 | |||
| 728 | </div><h3 id="Nested_Components">Nested Components</h3><div class="text"> |
||
| 729 | |||
| 730 | <p>None at this time.</p> |
||
| 731 | |||
| 732 | </div><h3 id="Special_Features">Special Features</h3><div class="text"> |
||
| 733 | |||
| 734 | <div class="subsection"><h4 id="Proxy_Support">Proxy Support</h4><div class="text"> |
||
| 735 | |||
| 736 | <p>The <code>proxyName</code> and <code>proxyPort</code> attributes can |
||
| 737 | be used when Tomcat is run behind a proxy server. These attributes |
||
| 738 | modify the values returned to web applications that call the |
||
| 739 | <code>request.getServerName()</code> and <code>request.getServerPort()</code> |
||
| 740 | methods, which are often used to construct absolute URLs for redirects. |
||
| 741 | Without configuring these attributes, the values returned would reflect |
||
| 742 | the server name and port on which the connection from the proxy server |
||
| 743 | was received, rather than the server name and port to whom the client |
||
| 744 | directed the original request.</p> |
||
| 745 | |||
| 746 | <p>For more information, see the |
||
| 747 | <a href="../proxy-howto.html">Proxy Support How-To</a>.</p> |
||
| 748 | |||
| 749 | </div></div> |
||
| 750 | |||
| 751 | <div class="subsection"><h4 id="Connector_Comparison">Connector Comparison</h4><div class="text"> |
||
| 752 | |||
| 753 | <p>Below is a small chart that shows how the connectors differ.</p> |
||
| 754 | |||
| 755 | <table class="defaultTable" style="text-align: center;"> |
||
| 756 | <tr> |
||
| 757 | <th></th> |
||
| 758 | <th style="text-align: center;">Java Nio Connector<br>NIO</th> |
||
| 759 | <th style="text-align: center;">Java Nio2 Connector<br>NIO2</th> |
||
| 760 | <th style="text-align: center;">APR/native Connector<br>APR</th> |
||
| 761 | </tr> |
||
| 762 | <tr> |
||
| 763 | <th>Classname</th> |
||
| 764 | <td><code class="noHighlight">AjpNioProtocol</code></td> |
||
| 765 | <td><code class="noHighlight">AjpNio2Protocol</code></td> |
||
| 766 | <td><code class="noHighlight">AjpAprProtocol</code></td> |
||
| 767 | </tr> |
||
| 768 | <tr> |
||
| 769 | <th>Tomcat Version</th> |
||
| 770 | <td>7.x onwards</td> |
||
| 771 | <td>8.x onwards</td> |
||
| 772 | <td>5.5.x onwards</td> |
||
| 773 | </tr> |
||
| 774 | <tr> |
||
| 775 | <th>Support Polling</th> |
||
| 776 | <td>YES</td> |
||
| 777 | <td>YES</td> |
||
| 778 | <td>YES</td> |
||
| 779 | </tr> |
||
| 780 | <tr> |
||
| 781 | <th>Polling Size</th> |
||
| 782 | <td><code class="noHighlight">maxConnections</code></td> |
||
| 783 | <td><code class="noHighlight">maxConnections</code></td> |
||
| 784 | <td><code class="noHighlight">maxConnections</code></td> |
||
| 785 | </tr> |
||
| 786 | <tr> |
||
| 787 | <th>Read Request Headers</th> |
||
| 788 | <td>Blocking</td> |
||
| 789 | <td>Blocking</td> |
||
| 790 | <td>Blocking</td> |
||
| 791 | </tr> |
||
| 792 | <tr> |
||
| 793 | <th>Read Request Body</th> |
||
| 794 | <td>Blocking</td> |
||
| 795 | <td>Blocking</td> |
||
| 796 | <td>Blocking</td> |
||
| 797 | </tr> |
||
| 798 | <tr> |
||
| 799 | <th>Write Response Headers and Body</th> |
||
| 800 | <td>Blocking</td> |
||
| 801 | <td>Blocking</td> |
||
| 802 | <td>Blocking</td> |
||
| 803 | </tr> |
||
| 804 | <tr> |
||
| 805 | <th>Wait for next Request</th> |
||
| 806 | <td>Non Blocking</td> |
||
| 807 | <td>Non Blocking</td> |
||
| 808 | <td>Non Blocking</td> |
||
| 809 | </tr> |
||
| 810 | <tr> |
||
| 811 | <th>Max Connections</th> |
||
| 812 | <td><code class="noHighlight">maxConnections</code></td> |
||
| 813 | <td><code class="noHighlight">maxConnections</code></td> |
||
| 814 | <td><code class="noHighlight">maxConnections</code></td> |
||
| 815 | </tr> |
||
| 816 | </table> |
||
| 817 | |||
| 818 | </div></div> |
||
| 819 | |||
| 820 | </div></div></div></div></div><footer><div id="footer"> |
||
| 821 | Copyright © 1999-2025, The Apache Software Foundation |
||
| 822 | <br> |
||
| 823 | Apache Tomcat, Tomcat, Apache, the Apache Tomcat logo and the Apache logo |
||
| 824 | are either registered trademarks or trademarks of the Apache Software |
||
| 825 | Foundation. |
||
| 826 | </div></footer></div></body></html> |