Menu

Per-directory rate limiting

Matt White
2010-12-04
2013-05-23
  • Matt White

    Matt White - 2010-12-04

    mod_qos seems very powerful, but I can't seem to determine whether it will support my specific case.  My web application creates one directory for each of my customers (e.g. /customer1/, /customer2/, etc.).  I would like to rate limit access to each of these directories to a certain number of requests per second, effectively setting a per-customer limit.  However, it looks like I would have to make a new QS entry in my apache configuration for each customer that signs up.  E.g.:

    QS_LocRequestPerSecLimitMatch ^http://domain\.com/customer1/.*$ 3
    QS_LocRequestPerSecLimitMatch ^http://domain\.com/customer1/.*$ 3

    Is there a way to use mod_qos to set a PerSecLimit on a per-directory basis.  Something like:

    QS_LocRequestPerSecLimitMatch ^http://domain\.com/(+)/.*$ 3

    Thanks.

    Matt

     
  • Pascal Buchbinder

    1) The QS_LocRequestPerSecLimitMatch directive does only match the path portion of an URL. So the settings should look like this:

    QS_LocRequestPerSecLimit /customer1 3
    QS_LocRequestPerSecLimit /customer2 3

    You don't need the QS_LocRequestPerSecLimitMatch directive for simple path mapping neither. The QS_LocRequestPerSecLimit is sufficient.

    2) You should always use the directive in conjunction with the QS_LocRequestLimit directive to limit the number of concurrent requests too.

    3) Now about your question: No it's not possible. Most mod_qos directives may only be specified on a per server level outside Location/Directory.

    The idea of a per server configuration was:
    a) to store the whole policy at a central place
    b) no need to specify Location/Directory entries
    c) no complicated (and difficult to document) merging between locations and sub-locations

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.