MOD_QOS(1)
๐ mod_qos(1) โ bestie edition, part 1 ๐
Okay so this is the mod_qos(1) manual page, aka the manual for mod_qos. It is long, so it comes in 3 parts, and this is part 1. We are keeping the exact same sections in the exact same order, and every single flag, argument, default, warning, and little gremlin detail is staying. No cap. ๐ซถ
โจ NAME โจ
mod_qos โ quality of service module for the Apache Web server. That is the whole NAME section, short and iconic. ๐
๐ธ DESCRIPTION ๐ธ
mod_qos is a quality of service module for the Apache Web server. It implements control mechanisms that can provide different levels of priority to different HTTP requests. It is literally giving bouncer-at-the-club energy, but the club is your server and the guests are HTTP requests. ๐
๐ OPTIONS ๐
Okay bestie, this is the big one. Every directive, every argument, every default, every condition. Let's go. ๐โโ๏ธโจ
QS_LocRequestLimitDefault <number>โ defines the default for theQS_LocRequestLimitandQS_LocRequestLimitMatchdirectives. It is the fallback number, the "if you did not say otherwise" vibe. โจQS_LocRequestLimit <location> <number>โ defines the maximum number of concurrent requests allowed to access the specified location. Default is defined by theQS_LocRequestLimitDefaultdirective. ๐ฆQS_LocRequestPerSecLimit <location> <number>โ defines the allowed number of requests per second to a location. Requests are limited by adding a delay to each request. This directive should be used in conjunction withQS_LocRequestLimitonly. โณQS_LocKBytesPerSecLimit <location> <kbytes>โ defines the allowed download bandwidth to the defined kbytes per second. Responses are slowed by adding a delay to each response (non-linear, bigger files get longer delay than smaller ones). This directive should be used in conjunction withQS_LocRequestLimitonly. ๐ขQS_LocRequestLimitMatch <regex> <number>โ defines the number of concurrent requests to the uri (path and query) pattern. Default is defined by theQS_LocRequestLimitDefaultdirective. ๐QS_LocRequestPerSecLimitMatch <regex> <number>โ defines the allowed number of requests per second to the uri (path and query) pattern. Requests are limited by adding a delay to each request. This directive should be used in conjunction withQS_LocRequestLimitMatchonly. โฑ๏ธQS_LocKBytesPerSecLimitMatch <regex> <kbytes>โ defines the allowed download bandwidth to the location matching the defined URL (path and query) pattern. Responses are slowed down by adding a delay to each response (non-linear, bigger files get longer delay than smaller ones). This directive should be used in conjunction withQS_LocRequestLimitMatchonly. ๐QS_CondLocRequestLimitMatch <regex> <number> <pattern>โ defines the number of concurrent requests to the uri (path and query) regex. The rule is only enforced if theQS_Condvariable matches the specified pattern (regex). Conditional queen behavior. ๐QS_EventRequestLimit <variable>[=<regex>] <number>โ defines the number of concurrent events. This directive works similar toQS_LocRequestLimit, but counts the requests having the same environment variable (and optionally matching its value, too) rather than those that have the same URL pattern. ๐๏ธQS_EventPerSecLimit [!]<variable> <number>โ defines how often requests may have the defined environment variable (literal string) set. It measures the occurrences of the defined environment variable on a request per seconds level and tries to limit this occurrence to the defined number. It works similar toQS_LocRequestPerSecLimit, but counts only the requests with the specified variable (or without it if the variable name is prefixed by a'!'). If a request matches multiple events, the rule with the lowest bandwidth is applied. Events are limited by adding a delay to each request causing an event. ๐ฎโ๐จQS_EventKBytesPerSecLimit [!]<variable> <kbytes>โ throttles the download bandwidth of all requests having the defined variable set to the defined kbytes per second. Responses are slowed by adding a delay to each response (non-linear, bigger files get longer delay than smaller ones). By default, no limitation is active. This directive should be used in conjunction withQS_EventRequestLimitonly (you must use the same variable name for both directives). ๐งQS_EventLimitCount <env-variable> <number> <seconds>โ defines the maximum number of events allowed within the defined time. Requests are denied when reaching this limitation for the specified time (blocked at request level). ๐ซQS_CondEventLimitCount <env-variable> <number> <seconds> <pattern>โ same asQS_EventLimitCountbut blocks requests only if theQS_Condvariable matches the specified pattern (regex). ๐ชQS_SrvMaxConn <number>โ defines the maximum number of concurrent TCP connections for this server (virtual host). ๐QS_SrvMaxConnClose <number>[%]โ defines the maximum number of concurrent TCP connections until the server disables keep-alive for this server (closes the connection after each requests). You may specify the number of connections as a percentage ofMaxClientsif adding the suffix'%'to the specified value. โ๏ธQS_SrvMaxConnPerIP <number> [<connections>]โ defines the maximum number of connections per source IP address for this server (virtual host).'connections'defines the number of busy connections of the server (all virtual hosts) to enable this limitation, default is0. ๐QS_SrvMaxConnExcludeIP <addr>โ excludes an IP address or address range from being limited. VIP pass, but for IPs. ๐๏ธQS_SrvMinDataRateIgnoreVIPโ tells theQS_SrvMaxConnPerIPdirective to ignore (if set to"on") the VIP status of clients. Default is"off", which means thatQS_SrvMaxConnPerIPis disabled for VIPs. ๐QS_SrvSerialize 'on'|'off' [<seconds>]โ ensures that not more than one request having theQS_SrvSerializevariable set is processed at the same time by serializing them (process one after each other). One at a time, bestie. ๐ถโโ๏ธQS_SrvDataRateOffโ disables theQS_SrvRequestRateandQS_SrvMinDataRateenforcement for a virtual host (only port/address based but not for name based virtual hosts). โQS_SrvRequestRate <bytes per seconds> [<max bytes per second>]โ defines the minimum upload throughput a client must generate. See alsoQS_SrvMinDataRate. ๐QS_SrvMinDataRate <bytes per seconds> [<max bytes per second> [<connections>]]โ defines the minimum upload/download throughput a client must generate (the bytes send/received by the client per seconds). This bandwidth is measured while transmitting the data (request line, header fields, request body, or response data). The client connection get closed if the client does not fulfill the required data rate and the IP address of the causing client get marked in order to be handled with low priority (see theQS_ClientPreferdirective). The"max bytes per second"activates dynamic minimum throughput control: The required minimal throughput is increased in parallel to the number of concurrent clients sending/receiving data. The"max bytes per second"setting is reached when the number of sending/receiving clients is equal to theMaxClientssetting. The"connections"argument is used to specify the number of busy TCP connections a server must have to enable this feature (0by default). No limitation is set by default. ๐๐ชQS_SrvMinDataRateOffEvent '+'|'-'<env-variable>โ disables the minimal data rate enforcement (QS_SrvMinDataRate) for a certain connection if the defined environment variable has been set. The'+'prefix is used to add a variable to the configuration while the'-'prefix is used to remove a variable. โโQS_SrvMinDataRateIgnoreVIPโ tells theQS_SrvMinDataRatedirective to ignore (if set to"on") the VIP status of clients. Default is"off", which means thatQS_SrvMinDataRateis disabled for VIPs. ๐ (Yes, this one is back with a different BFF directive. The manual lists it twice, so we list it twice. Periodt.)QS_SrvSampleRate <seconds>โ defines the sampling rate used by theQS_SrvMinDataRatedirective to measure the throughput of a connection. ๐QS_DenyRequestLine '+'|'-'<id> 'log'|'deny' <regular expression>โ generic request line (method, path, query and protocol) filter used to deny access for requests matching the defined regular expression.'+'adds a new rule while'-'removes a rule for a location. The action is either'log'(access is granted but rule match is logged) or'deny'(access is denied). ๐QS_DenyPathโ same asQS_DenyRequestLinebut applied to the path only. ๐ฃ๏ธQS_DenyQueryโ same asQS_DenyRequestLinebut applied to the query only. ๐QS_DenyEvent '+'|'-'<id> 'log'|'deny' [!]<variable>โ matches requests having the defined process environment variable set (or NOT set if prefixed by a'!'). The action taken for matching rules is either'log'(access is granted but the rule match is logged) or'deny'(access is denied). ๐งจQS_PermitUri '+'|'-'<id> 'log'|'deny' <regular expression>โ generic request filter applied to the request uri (path and query). Only requests matching at least oneQS_PermitUripattern are allowed. If aQS_PermitUripattern has been defined and the request does not match any rule, the request is denied albeit of any server resource availability (allow list). All rules must define the same action. Regular expression is case sensitive. โQS_DenyBody 'on'|'off'โ enabled body data filter (obsolete). ๐งQS_DenyQueryBody 'on'|'off'โ enabled body data filter forQS_DenyQuery. ๐ฆQS_PermitUriBody 'on'|'off'โ enabled body data filter forQS_PermitUriBody. ๐คQS_InvalidUrlEncoding 'log'|'deny'|'off'โ enforces correct URL decoding in conjunction with theQS_DenyRequestLine,QS_DenyPath, andQS_DenyQuerydirectives. Default is"off". ๐งผQS_LimitRequestBody <bytes>โ limits the allowed size of an HTTP request message body. ๐QS_DenyDecoding 'uni'โ enabled additional string decoding functions which are applied before matchingQS_Deny*andQS_Permit*directives. Default is URL decoding (%xx, , '+'). ๐งฌQS_DenyInheritanceOffโ disable inheritance ofQS_Deny*andQS_Permit*directives to a location. ๐ซQS_RequestHeaderFilter 'on'|'off'|'size'โ filters request headers by allowing only these headers which match the request header rules defined bymod_qos. Request headers which do not conform these definitions are either dropped or the whole request is denied. Custom request headers may be added by theQS_RequestHeaderFilterRuledirective. Using the'size'option, the header field max. size is verified only (similar toLimitRequestFieldsizebut using individual values for each header type) while the pattern is ignored. ๐งนQS_ResponseHeaderFilter 'on'|'off'โ filters response headers by allowing only these headers which match the response header rules defined bymod_qos. Response headers which do not conform these definitions are dropped. ๐งฝQS_RequestHeaderFilterRule <header name> 'drop'|'deny' <regular expression> <size>โ used to add custom request header filter rules which override the internal filter rules ofmod_qos. Directive is allowed in global server context only. ๐QS_ResponseHeaderFilterRule <header name> <regular expression> <size>โ used to add custom response header filter rules which override the internal filter rules ofmod_qos. Directive is allowed in global server context only. ๐QS_MileStone 'log'|'deny' <pattern> [<thinktime>]โ defines request line patterns a client must access in the defined order as they are defined in the configuration file. ๐ชจQS_MileStoneTimeout <seconds>โ defines the time in seconds within a client must reach the next milestone. Default are3600seconds. โฐQS_SessionCookieName <name>โ defines a custom session cookie name, default isMODQOS. ๐ช
okay bestie we're still in the directives, keep scrolling, we're not done slaying ๐
QS_SessionCookiePath <path>โ sets where the cookie lives. The default is"/". Simple as that. ๐ชQS_SessionTimeout <seconds>โ how long a VIP's session lasts. Heads up though: this is only for session-based (cookie) VIP identification, not the IP-based kind. Default is3600seconds. โฐQS_SessionKey <string>โ the secret key used for cookie encryption. You want this when the same session cookie is shared across multiple web servers (hello, load balancing ๐) or when sessions should survive a server restart. By default a random key is used which changes every server restart โ so like, your sessions get amnesia every time you restart. ๐ญQS_VipHeaderName <name>[=<regex>] [drop]โ defines an HTTP response header that marks a user as a VIP. mod_qos creates a session for this user by setting a cookie, e.g. after successful user authentication. It optionally tests the header's value against the provided regular expression. Add the actiondropif you want mod_qos to remove this control header from the HTTP response. ๐QS_VipIPHeaderName <name>[=<regex>] [drop]โ same energy, but this header marks a client source IP address as a VIP. Also optionally tests its value against the provided regular expression. And yeah,dropremoves this control header from the HTTP response too. ๐QS_VipUserโ makes a VIP session for users who've been authenticated by the Apache server, e.g. by the standardmod_auth*modules. Works similar to theQS_VipHeaderNamedirective. vibe check: passed โQS_VipIpUserโ marks a source IP address as a VIP if the user has been authenticated by the Apache server, e.g. by the standardmod_auth*modules. Works similar to theQS_VipIPHeaderNamedirective. ๐ซถQS_UserTrackingCookieName <name> [<path>] [<domain>] ['session'] ['jsredirect']โ turns on the user tracking cookie by giving it a cookie name. Thepathparameter is an option cookie check page which is used to ensure the client accepts cookies. Thedomainoption defines theDomainattribute for theSet-Cookieheader. The optionsessionindicates that the cookie shall be a session cookie expiring when the user closes it's browser. User tracking requiresmod_unique_id. This feature is disabled by default. It ignoresQS_LogOnly. ๐QS_SetEnvIf [!]<variable1>[=<regex>] [[!]<variable2>] [!]<variable=value>โ sets (or unsets) thevariable=value(literal string) if variable1 (literal string) AND variable2 (literal string) are set in the request environment variable list (not case sensitive). This is used to combine multiple variables to a new event type. Alternatively, a regular expression can be specified for variable1's value and variable2 must be omitted in order to simply set a new variable if the regular expression matches. ๐งฉQS_SetEnvIfCmpP <env-variable1> eq|ne|gt|lt <env-variable2> [!]<env-variable>[=<value>]โ sets the specified environment variable if the specified env-variables are alphabetically or numerical equal (eq), not equal (ne), greater (gt), or less (lt). comparison core ๐งฎQS_SetEnvIfQuery <regex> [!]<variable>[=value]โ works quite similar to theSetEnvIfdirective of the Apache modulemod_setenvif, but the specified regex is applied against the query string portion of the request line. It recognizes the occurrences of$1..$9within value and replaces them by the sub-expressions of the defined regex pattern. ๐QS_SetEnvIfParp <regex> [!]<variable>[=value]โ parses the request payload using the Apache modulemod_parp. It matches the request URL query and the HTTP request message body data as well ('application/x-www-form-urlencoded','multipart/form-data', and'multipart/mixed') and sets the defined process variable (quite similar to theQS_SetEnvIfQuerydirective). It recognizes the occurrences of$1..$9within value and replaces them by the sub-expressions of the defined regex pattern. This directive activatesmod_parpfor every request to the virtual host. You may deactivatemod_parpfor selected requests using theSetEnvIfdirective: unset the variableparpto do so.
โ ๏ธ Important: request message body processing requires that the server loads the whole request into its memory (at least twice the length of the message). You should limit the allowed size of the HTTP request message body using theQS_LimitRequestBodydirective when usingQS_SetEnvIfParp! ๐
QS_SetEnvIfBody <regex> [!]<variable>[=value]โ parses the request body using the Apache modulemod_parp. Specify the content types to process using themod_parpdirectivePARP_BodyDataand ensure thatmod_parpis enabled using theSetEnvIfdirective of the Apache modulemod_setenvif. You should limit the allowed size of HTTP requests message body using theQS_LimitRequestBodydirective when usingmod_parp. The directive recognizes the occurrence of$1within the variable value and replaces it by the sub-expressions of the defined regex pattern. ๐ฆQS_SetEnvStatusโ (deprecated, useQS_SetEnvIfStatus) ๐QS_SetEnvIfStatus <status code> <variable>โ adds the defined request environment variable if the HTTP status code matches the defined value. A few special status codes live here:- The value
QS_SrvMinDataRatemay be used as a special status code to set aQS_Blockevent in order to handle connection close events caused byQS_SrvMinDataRaterules. - The status
NullConnectionmay be used to mark connections which are closed before any HTTP request has ever been received. - The
QS_SrvMaxConnPerIPvalue may be used to countQS_Blockevents for connections closed by theQS_SrvMaxConnPerIPdirective. - The
BrokenConnectionvalue may be used to mark clients not reading the full HTTP response. ๐ค
- The value
QS_SetEnvResBodyโ (deprecated, useQS_SetEnvIfResBody) โ๏ธQS_SetEnvIfResBody <string> [!]<variable>โ adds the defined request environment variable (e.g.QS_Block) if the HTTP response body contains the defined literal string. Just so you know: it supports only one pattern per location. ๐QS_SetEnv <variable> <value>โ sets the defined variable with the value, where the value string may contain other environment variables surrounded by"${"and"}". The variable is only set if all defined variables within the value can be resolved. no half-finished vibes here ๐QS_SetReqHeader [!]<header name> <variable> ['late']โ sets the defined HTTP request header to the request if the specified environment variable is set. ๐จQS_UnsetReqHeader <header name>โ removes the specified header from the request. bye felicia ๐QS_UnsetResHeader <header name>โ removes the specified header from the response. also bye ๐QS_SetEnvResHeader <header name> [drop]โ sets the defined HTTP response header (name and value) to the request environment variables. Deletes the header if the actiondrophas been specified. ๐๏ธQS_SetEnvResHeaderMatch <header name> <regex>โ sets the defined HTTP response header (name and value) to the request environment variables if the specified regular expression matches the header value. match made in heaven โจQS_SetEnvRes <variable> <regex> <variable2>[=<value>]โ setsvariable2if the regular expression matches against the value of the environment variable. Occurrences of$1..$9within the value get replaced by parenthesized subexpressions of the regular expression. ๐ฅQS_RedirectIf <variable> <regex> [<code>:]<url>โ redirects the client to the configured url if the regular expression matches the value of the environment variable. yeet them elsewhere ๐QS_ClientEntries <number>โ defines the number of individual clients managed by mod_qos. Default is50000. Heads up: this directive is allowed in global server context only. ๐QS_ClientPrefer [<percent>]โ prefers known VIP clients when the server has less than80%(or the configured value) of free TCP connections. Preferred clients are VIP clients (or those without any negative penalties) โ see theQS_VipHeaderNamedirective. Global server context only. ๐QS_ClientTolerance <percent>โ defines the allowed tolerance (variation) from a "normal" client (average) in percent. Default is20%. Global server context only. ๐QS_ClientContentTypes <html> <css/js> <images> <other> <304>โ defines the distribution of HTTP response content types a client normally receives when accessing the server. mod_qos normally learns the average behavior automatically by default, but you may specify a static configuration in order to avoid influences by a high number of abnormal clients. ๐จQS_ClientEventBlockCount <number> [<seconds>]โ defines the maximum number ofQS_Blockallowed within the defined time (default are10minutes). Global server context only. ๐ซQS_ClientEventBlockExcludeIP <addr>โ excludes an IP address or address range from being limited byQS_ClientEventBlockCount. exempt, bestie ๐QS_ClientEventLimitCount <number> [<seconds> [<variable>]]โ defines the maximum number of the specified environment variable (QS_Limitby default) allowed within the defined time (default are10minutes). Global server context only. โณQS_CondClientEventLimitCount <number> <seconds> <variable> <pattern>โ defines the maximum number of the specified environment variable allowed within the defined time. It works similar toQS_ClientEventLimitCount, but requests are only blocked if theQS_Condvariable matches the defined pattern (regex). Global server context only. ๐ฏQS_ClientEventPerSecLimit <number>โ defines the number events pro seconds on a per client (source IP) basis. Events are identified by requests having theQS_Eventvariable set. Global server context only. โกQS_ClientEventRequestLimit <number>โ defines the allowed number of concurrent requests coming from the same client source IP address having theQS_EventRequestvariable set. Global server context only. ๐งตQS_ClientSerializeโ serializes requests having theQS_Serializevariable set if they are coming from the same IP address. one at a time, we wait our turn ๐QS_ClientIpFromHeader <header>โ defines a HTTP request header to read the client's source IP address from (instead of taking the IP address of the client opening the TCP connection). ๐ต๏ธQS_ClientGeoCountryDB <path>โ path to the geograpical database file. ๐QS_ClientGeoCountryPriv <list> <connections> ['excludeUnknown']โ defines a comma separated list of country codes for origin client IP address which are allowed to access the server if the number of busy TCP connections reaches the defined number of connections, while others are denied access. Clients whose IP can't be mapped to a country code can be excluded from the limitation by configuring the'excludeUnknown'argument. ๐บ๏ธ
Overrides QS_ClientIpFromHeader for the use with QS_Country variable.
QS_ErrorPage <url>โ defines a custom error page. make it cute ๐ธQS_ErrorResponseCode <code>โ defines the HTTP response code which is used when a request is denied, default is500. ๐ญQS_ForcedClose 'on'|'off'โ defines if the mod_qos connection handler shall exit with an error code (on) or not. Default ison(except for Apache2.4.49). ๐
QS_LogOnly 'on'|'off'โ turns on the module's log-only mode, where it literally just watches and writes stuff down and enforces nothing โ no limits, no blocks, just vibes and receipts ๐. Default isoff. Heads up bestie: this directive is allowed in global server context only, so don't try to sneak it into a<VirtualHost>.QS_LogEnv 'on'|'off'โ switches on logging of environment variables ๐ซง.QS_SupportIPv6 'on'|'off'โ enables IPv6 address support ๐. Default ison, as it should be, we're not living in 2009.QS_SemMemFile <path>โ optional path to a directory or file that mod_qos should use for its file-based semaphores / shared memory usage, e.g./var/tmp๐๏ธ.QS_MaxClients <number>โ optional override for mod_qos's ownMaxClients/MaxRequestWorkerscalculation, which is the thing that defines the maximum number of TCP connections the server can handle ๐.QS_DisableHandler 'on'|'off'โ disables theqos-viewerandqos-consolefor a virtual host ๐ซ๐ฅ๏ธ.QS_Status 'on'|'off'โ writes a log message containing server statistics once every minute โฑ๏ธโจ. Default isoff.QS_EventCount 'on'|'off'โ enables error event counting, and those counters show up in the machine-readable version of the status viewer ๐ข. Default isoff.QSLog <arg>โ used to configure a global (per Apache instance)qsloglogger ๐ชต๐ .
๐ AUTHOR ๐
Pascal Buchbinder, http://mod-qos.sourceforge.net/ โ the icon, the legend, the person who wrote all of this ๐๐ซถ
okay and that's a wrap on MOD_QOS(1) bestie!! ๐ this one shipped as the mod_qos Apache Module man page, dated May 2026 โจ go forth and throttle responsibly, ily ๐๐ฆ
๐ฆ where this page comes from
- ubuntu stonking: libapache2-mod-qos 11.79-1build1 ยท Apache-2.0
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms