PleaseStop
A rate limiter plug for Phoenix.
Installation
the package can be installed by adding please_stop to your list of dependencies in mix.exs:
def deps do
[
{:please_stop, "~> 0.1.0"}
]
endUsage
To use PleaseStop in Phoenix you can use it just like any other plug.
scope "/avatars" do
plug PleaseStop, limit: 5000, ttl: :timer.minutes(1), namespace: :avatars
scope "/something" do
plug PleaseStop, limit: 5, ttl: :timer.minutes(10), namespace: :something
end
endOptions
The options provided to PleaseStop are detailed below
limit: The maximum number of requests you’ll accept within the providedttl.ttl: The amount of time before the request count is set back to0. If thelimitis reached within thisttl, a429will be returned and theconnwill be halted.namespace: The namespace where your rate limiting information is kept.