<short>limits concurrent connections or requests per second.</short>
<description>
Both limits can be "in total" or per IP.
</description>
<actionname="limit.con">
<short>limits the total amount of concurrent connections to the specified limit.</short>
<parametername="limit">
<short>the maximum number of concurrent connections</short>
</parameter>
<parametername="action">
<short>(optional) an action to be executed when the limit is reached</short>
</parameter>
<description>
If no action is defined a 503 error page will be returned. If it is specified there is no other special handling apart from running the specified action when the limit is reached.
</description>
<example>
<config>
limit.con 10;
</config>
</example>
</action>
<actionname="limit.con_ip">
<short>limits the total amount of concurrent connections per IP to the specified limit.</short>
<parametername="limit">
<short>the maximum number of concurrent connections per IP</short>
</parameter>
<parametername="action">
<short>(optional) an action to be executed when the limit is reached</short>
</parameter>
<description>
If no action is defined a 503 error page will be returned. If it is specified there is no other special handling apart from running the specified action when the limit is reached.
</description>
<example>
<config>
limit.con_ip 2;
</config>
</example>
</action>
<actionname="limit.req">
<short>limits the amount of requests per second to the specified limit.</short>
<parametername="limit">
<short>the maximum number of requests per second</short>
</parameter>
<parametername="action">
<short>(optional) an action to be executed when the limit is reached</short>
</parameter>
<description>
If no action is defined a 503 error page will be returned. If it is specified there is no other special handling apart from running the specified action when the limit is reached.
</description>
<example>
<config>
limit.req 100;
</config>
</example>
</action>
<actionname="limit.req_ip">
<short>limits the amount of requests per second per IP to the specified limit.</short>
<parametername="limit">
<short>the maximum number of requests per second per IP</short>
</parameter>
<parametername="action">
<short>(optional) an action to be executed when the limit is reached</short>
</parameter>
<description>
If no action is defined a 503 error page will be returned. If it is specified there is no other special handling apart from running the specified action when the limit is reached.
This config snippet will allow only 10 active downloads overall and 1 per IP. If the limit is exceeded, either because more than 10 people try to access this resource or one person tries a second time while having one download running already, they will be redirected to /connection_limit_reached.html.
</description>
<config>
setup {
module_load ("mod_limit","mod_redirect");
}
limit_reached = {
redirect "/connection_limit_reached.html";
};
if req.path =^ "/downloads/" {
limit.con 10 => limit_reached;
limit.con_ip 1 => limit_reached;
}
</config>
</example>
<exampletitle="Limiting requests per second"anchor="#">