This is partly an academic question, but how would one add a no-limit-rate-limiter
and a catch-all-rate-limiter
? Is the config below correct? I've tested a bit and it seems fine, but I'm not sure if some preflight requests maybe caused the rate-limiter to fire. Also I'm not sure, because the config mentions, that average 0 means no limit and I'm toying with edge cases here - which might be handy.
The use case for a no-limit-rate-limiter
would be just testing. E.g. in case there is an actual rate-limiter in place and one wants to test if disabling the rate-limiter fixes some application issue. So one could change the config to something like below, instead of commenting the middleware on every route or such.
The use case of the catch-all-rate-limiter
is a very simple web-application-firewall. Using redirects to http://127.0.0.1
might also be an option in this case, but I think the rate-limiter should be faster because the rate-limiter avoids the redirect middleware's regex parsing. Although this might be negligible - that's why it's kind of an academic question. Another use case might also just testing if some route regex is correct.
http:
middlewares:
catch-all-rate-limiter:
rateLimit:
average: 1
period: 1
burst: 0
no-limit-rate-limiter:
rateLimit:
average: 0
period: 1
burst: 1