| <?xml version="1.0"?> |
| <!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd"> |
| <?xml-stylesheet type="text/xsl" href="../style/manual.en.xsl"?> |
| <!-- $LastChangedRevision$ --> |
| |
| <!-- |
| Licensed to the Apache Software Foundation (ASF) under one or more |
| contributor license agreements. See the NOTICE file distributed with |
| this work for additional information regarding copyright ownership. |
| The ASF licenses this file to You under the Apache License, Version 2.0 |
| (the "License"); you may not use this file except in compliance with |
| the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| --> |
| |
| <modulesynopsis metafile="mod_reqtimeout.xml.meta"> |
| |
| <name>mod_reqtimeout</name> |
| <description>Set timeout and minimum data rate for receiving requests |
| </description> |
| <status>Extension</status> |
| <sourcefile>mod_reqtimeout.c</sourcefile> |
| <identifier>reqtimeout_module</identifier> |
| |
| <summary> |
| <p>This module provides a convenient way to set timeouts and minimum data |
| rates for receiving requests. Should a timeout occur or a data rate be |
| to low, the corresponding connection will be closed by the server.</p> |
| |
| <p>This is logged at <directive module="core">LogLevel</directive> |
| <code>info</code>.</p> |
| |
| <p>If needed, the <directive module="core">LogLevel</directive> directive |
| can be tweaked to explicitly log it:</p> |
| <highlight language="config"> |
| LogLevel reqtimeout:info |
| </highlight> |
| </summary> |
| |
| <section id="examples"><title>Examples</title> |
| |
| <ol> |
| <li> |
| Allow for 5 seconds to complete the TLS handshake, 10 seconds to |
| receive the request headers and 30 seconds for receiving the |
| request body: |
| |
| <highlight language="config"> |
| RequestReadTimeout handshake=5 header=10 body=30 |
| </highlight> |
| </li> |
| |
| <li> |
| Allow at least 10 seconds to receive the request body. |
| If the client sends data, increase the timeout by 1 second for every |
| 1000 bytes received, with no upper limit for the timeout (except for |
| the limit given indirectly by |
| <directive module="core">LimitRequestBody</directive>): |
| |
| <highlight language="config"> |
| RequestReadTimeout body=10,MinRate=1000 |
| </highlight> |
| </li> |
| |
| <li> |
| Allow at least 10 seconds to receive the request headers. |
| If the client sends data, increase the timeout by 1 second for every |
| 500 bytes received. But do not allow more than 30 seconds for the |
| request headers: |
| |
| <highlight language="config"> |
| RequestReadTimeout header=10-30,MinRate=500 |
| </highlight> |
| </li> |
| |
| <li> |
| Usually, a server should have both header and body timeouts configured. |
| If a common configuration is used for http and https virtual hosts, the |
| timeouts should not be set too low: |
| |
| <highlight language="config"> |
| RequestReadTimeout header=20-40,MinRate=500 body=20,MinRate=500 |
| </highlight> |
| </li> |
| |
| </ol> |
| </section> |
| |
| <directivesynopsis> |
| <name>RequestReadTimeout</name> |
| <description>Set timeout values for completing the TLS handshake, receiving |
| the request headers and/or body from client. |
| </description> |
| <syntax>RequestReadTimeout |
| [handshake=<var>timeout</var>[-<var>maxtimeout</var>][,MinRate=<var>rate</var>] |
| [header=<var>timeout</var>[-<var>maxtimeout</var>][,MinRate=<var>rate</var>] |
| [body=<var>timeout</var>[-<var>maxtimeout</var>][,MinRate=<var>rate</var>] |
| </syntax> |
| <default>RequestReadTimeout handshake=0 header=20-40,MinRate=500 body=20,MinRate=500</default> |
| <contextlist><context>server config</context><context>virtual host</context> |
| </contextlist> |
| <compatibility>Defaulted to disabled in version 2.3.14 and earlier. The |
| <code>handshake</code> stage is available since version 2.4.39. |
| </compatibility> |
| |
| <usage> |
| <p>This directive can set various timeouts for completing the TLS handshake, |
| receiving the request headers and/or the request body from the client. |
| If the client fails to complete each of these stages within the configured |
| time, a <code>408 REQUEST TIME OUT</code> error is sent.</p> |
| |
| <p>For SSL virtual hosts, the <code>handshake</code> timeout values is the time |
| needed to do the initial SSL handshake. If the user's browser is configured to |
| query certificate revocation lists and the CRL server is not reachable, the |
| initial SSL handshake may take a significant time until the browser gives up |
| waiting for the CRL. Therefore the <code>handshake</code> timeout should take |
| this possible overhead into consideration for SSL virtual hosts (if necessary). |
| The body timeout values include the time needed for SSL renegotiation |
| (if necessary).</p> |
| |
| <p>When an <directive module="core">AcceptFilter</directive> is in use |
| (usually the case on Linux and FreeBSD), the socket is not sent to the |
| server process before at least one byte (or the whole request for |
| <code>httpready</code>) is received. The handshake and header timeouts |
| configured with <directive>RequestReadTimeout</directive> are only effective |
| after the server process has received the socket.</p> |
| |
| <p>When waiting for a subsequent request on a kept-alive |
| connection, the timeout configured by <directive |
| module="core">KeepAliveTimeout</directive> applies regardless of |
| whether <directive>RequestReadTimeout</directive> is also |
| used.</p> |
| |
| <p>For each of the three timeout stages (handshake, header or body), there are |
| three ways to specify the timeout: |
| </p> |
| |
| <ul> |
| |
| <li><strong>Fixed timeout value</strong>:<br /> |
| |
| <example><var>stage</var>=<var>timeout</var></example> |
| |
| <p>The time in seconds allowed for completing the whole stage (handshaking, |
| reading all of the request headers or body). A value of 0 means no limit.</p> |
| </li> |
| |
| <li><strong>Disable module for a vhost</strong>:<br /> |
| |
| <example>handshake=0 header=0 body=0</example> |
| |
| <p>This disables <module>mod_reqtimeout</module> completely (note that |
| <code>handshake=0</code> is the default already and could be omitted).</p> |
| </li> |
| |
| <li><strong>Timeout value that is increased when data is |
| received</strong>:<br /> |
| <example> |
| <var>stage</var>=<var>timeout</var>,MinRate=<var>data_rate</var> |
| </example> |
| |
| <p>Same as above, but whenever data is received, the timeout value is |
| increased according to the specified minimum data rate (in bytes per |
| second).</p> |
| </li> |
| |
| <li><strong>Timeout value that is increased when data is received, with an |
| upper bound</strong>:<br /> |
| <example> |
| <var>stage</var>=<var>timeout</var>-<var>maxtimeout</var>,MinRate=<var>data_rate</var> |
| </example> |
| |
| <p>Same as above, but the timeout will not be increased above the second |
| value of the specified timeout range.</p> |
| </li> |
| |
| </ul> |
| |
| </usage> |
| |
| </directivesynopsis> |
| |
| </modulesynopsis> |