Giter Site home page Giter Site logo

Global API limit about ratelimitbundle HOT 7 OPEN

jaytaph avatar jaytaph commented on May 19, 2024 1
Global API limit

from ratelimitbundle.

Comments (7)

jason-linthwaite avatar jason-linthwaite commented on May 19, 2024 2

+1 to this. I have set the "path_limits" in the config file to my root API path but it seems to have no effect.
I don't want to have to specify this on every controller. Is this the intended action? If so, why require the path limits config?

from ratelimitbundle.

asilelik avatar asilelik commented on May 19, 2024 1

This issue can be closed as it seems like #119

New usage:

path_limits:
- { path: *, method: *, limit: 1000, period: 3600 }

from ratelimitbundle.

ndench avatar ndench commented on May 19, 2024

This issue is pretty old now. Has anyone fond a way to achieve a global rate limit?

from ratelimitbundle.

pesseyjulien avatar pesseyjulien commented on May 19, 2024

path_limits:
- { path: /, limit: 1000, period: 3600 }

from ratelimitbundle.

goetas avatar goetas commented on May 19, 2024

You have the full config list at https://github.com/jaytaph/RateLimitBundle#configuration-reference

from ratelimitbundle.

ndench avatar ndench commented on May 19, 2024

from ratelimitbundle.

stefanides avatar stefanides commented on May 19, 2024

Hi, I am trying to use pesseyjulien's solution above for global limit for all routes. Once the path config contains something more than '/', the PathLimitProcessor compares it by parts in pathMatched() method and it works fine as prefix. However, when the path is just '/', it gets trimmed in constructor to an empty string and then pathMatched() compares '' to any string present in URL, which is false - except the homepage path itself. The same can be seen watching http headers - they are present only for '/' route and no other/longer path. Should there be some more test for this scenario inside pathMatched() like
if (count($expectedParts) == 1 && $expectedParts[0] == '') { return true; }
?
Then also the constructor needs to be updated - to sort '' lower than 'xyz' paths even they have the same substr_count(), current code keeps the original sort from config file.

Tested on "version": "1.15.1"

from ratelimitbundle.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.