Menu

Limiting connections to URL's by mask per 10 seconds

2013-12-03
2020-02-28
  • Max Smirnov

    Max Smirnov - 2013-12-03

    Hi,

    I need to implement a limit number of connections to the URL's by mask (^/url/) not per one second, but per 10 seconds to 3. Is it possible with mod_qos? Can you give an example of config?

    And one more question, does the mod_qos changes HTTP headers sent to Apache, like nginx write client IP address to X-Real-IP or X-Forwarded-For?

    Thanks.

     
  • Pascal Buchbinder

    Eaxmple:

    SetEnvIf Request_URI ^/url/ LimitMe
    QS_EventLimitCount LimitMe 10 3
    

    mod_qos may set headers using http://opensource.adnovum.ch/mod_qos/#QS_SetReqHeader
    but you might also want to have a look at those resources:

     
    • Amanullah Khan

      Amanullah Khan - 2020-02-26

      my objective is a little bit different. I have dynamic URL from server. And i want to limit each URL only 8 connections.

      SetEnvIf Request_URI ^/en/.+ LimitMe
      QS_EventRequestLimit LimitMe 10

      but still it's only working for the 1st URL only not for the 2nd or others. Also i woould like to donate where i can do that ??

       
      • Pascal Buchbinder

        You can use QS_LocRequestLimitMatch to limit the number of concurrent requests allowed for a predefined URL pattern.

        QS_LocRequestLimitMatch ^/en/ 10
        

        But this creates only one single counter which counts every request to an URL matching the provided regular expression.

        If you need a separate counter for each URL, you would have to configure separate rules (which means that at least part of the dynamic URL must be already known in advance).

         QS_LocRequestLimitMatch ^/en/ 10
         QS_LocRequestLimitMatch ^/it/ 10
         QS_LocRequestLimitMatch ^/fr/ 10
         QS_LocRequestLimitMatch ^/es/ 10
         QS_LocRequestLimitMatch ^/de/ 10
        
         

        Last edit: Pascal Buchbinder 2020-02-27
  • Amanullah Khan

    Amanullah Khan - 2020-02-27

    Soory but this is not working

    if i use only
    QS_EventRequestLimit ^/en/ 10
    it did not work
    but if use

    SetEnvIf Request_URI ^/en/ LimitMe
    QS_EventRequestLimit LimitMe 10
    

    the above works.

    now i would like to explain my URL
    i have following types of URL

    http://xx.xx.x.x/en/t8vm81ky3ob3-65881-2/1.rar ==> this should be 10 connect, no IP limit
    http://xx.xx.x.x/en/at49yfx31nyq-75317-2/2.rar ==> this should be 10 connect, no IP limit but every URL

     
    • Pascal Buchbinder

      Ah I'm sorry
      I used QS_LocRequestLimitMatch in the text but the wrong directive in the example
      I updted may comment above.

       
    • Pascal Buchbinder

      If 1.rar and 2.rar are known file names, you could configure

      QS_LocRequestLimitMatch ^/en/.*/1.rar
      QS_LocRequestLimitMatch ^/en/.*/2.rar
      
       
      • Amanullah Khan

        Amanullah Khan - 2020-02-27

        sir again you are getting mistake, i dont have only one URL. i have 200-300
        URLs. So adding each of them is very hard for me. Cann't we add some rule ?? that will work for any url. As i said earlier the URLs are dynamic.

         

        Last edit: Amanullah Khan 2020-02-27
        • Pascal Buchbinder

          Aha, I was not sure what you really intended to configure (does not really fit this discussion - it's not really related to this topic here).

          So you would need a rule which limits the number of "the very same" requests: check, how many other requests are accessing the server using the same URL, e.g. by iterating through the scoreboard, right?

          No, that's currently not possible.
          And I don't understand the benefit of such a rule.

           

          Last edit: Pascal Buchbinder 2020-03-04
          • Amanullah Khan

            Amanullah Khan - 2020-02-28

            i think i am not able to express my question clear to you. See it's just i
            don't want limit over IP but over the URLs.I mean it should work for any
            URL from the server.

            On Thu, 27 Feb 2020 at 22:55, Pascal Buchbinder pbuchbinder@users.sourceforge.net wrote:

            Aha, I was not sure want you really intended to configure (does not really
            fit this discussion - not really related to this topic here).

            So you would need a rule which limits the number of "the very same"
            requests: check, how many other requests are accessing the server using the
            same URL, e.g. by iterating through the scoreboard.

            No, that's currently not possible.
            And I don't understand the benefit of such a rule.


            Limiting connections to URL's by mask per 10 seconds
            https://sourceforge.net/p/mod-qos/discussion/697421/thread/2917b50e/?limit=25#fbc5/a6ea/880c/9989


            Sent from sourceforge.net because you indicated interest in
            https://sourceforge.net/p/mod-qos/discussion/697421/

            To unsubscribe from further messages, please visit
            https://sourceforge.net/auth/subscriptions/

             

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.