Coder Social home page Coder Social logo

Comments (10)

lchayoun avatar lchayoun commented on May 3, 2024 1

It sounds to me that you need to create a filter that extends the RateLimitPreFilter and one that extends the RateLimitPostFilter
set zuul.rateLimit.enabled=false (or don't add it since it is the defualt) to disable the existing filters
then override the logic of the shouldFilter in each filter to match your dynamic logic

from spring-cloud-zuul-ratelimit.

lchayoun avatar lchayoun commented on May 3, 2024

You can set the zuul.rateLimit.enabled=false, why do you need another flag?

from spring-cloud-zuul-ratelimit.

jakubzloczewski avatar jakubzloczewski commented on May 3, 2024

My need is to steer this flag in runtime - for example depending on request origin or user.

Do you suggest to wire RateLimitProperties bean and use setEnabled method to modify flag? I'm not sure if it is safe to modify it as it is global state not in context of request.

from spring-cloud-zuul-ratelimit.

jakubzloczewski avatar jakubzloczewski commented on May 3, 2024

Ok, thanks for advice. I will give a try.

from spring-cloud-zuul-ratelimit.

lchayoun avatar lchayoun commented on May 3, 2024

@jakubzloczewski can we close this issue?

from spring-cloud-zuul-ratelimit.

fudali113 avatar fudali113 commented on May 3, 2024

@jakubzloczewski Do you think this will solve your problem? #41

from spring-cloud-zuul-ratelimit.

jakubzloczewski avatar jakubzloczewski commented on May 3, 2024

Yes, it works. Thanks!

from spring-cloud-zuul-ratelimit.

angshuman-agarwal avatar angshuman-agarwal commented on May 3, 2024

It sounds to me that you need to create a filter that extends the RateLimitPreFilter and one that extends the RateLimitPostFilter
set zuul.rateLimit.enabled=false (or don't add it since it is the defualt) to disable the existing filters
then override the logic of the shouldFilter in each filter to match your dynamic logic

I tried this suggestion in version 2.2.1.RELEASE. But, I am getting error saying Could not autowire. No beans of 'RateLimitProperties' type found and same error for other classes being injected in ctor - RateLimiter, RateLimitKeyGenerator and RateLimitUtils.

Any idea how to make that work please ?

from spring-cloud-zuul-ratelimit.

marcosbarbero avatar marcosbarbero commented on May 3, 2024

@angshuman-agarwal this issue was closed almost 3 years ago and a lot has changed to the project structure during this time. I recommend you open a new issue detailing your use-case.

from spring-cloud-zuul-ratelimit.

angshuman-agarwal avatar angshuman-agarwal commented on May 3, 2024

Sorry about that. I have raised it separately - #396

from spring-cloud-zuul-ratelimit.

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.