Popularity
0.9
Growing
Activity
0.0
Stable
5
1
1

Description

Elixir Plug for Ralitobu, the Rate Limiter with Token Bucket algorithm

Monthly Downloads: 0
Programming language: Elixir
License: MIT License

Ralitobu.Plug alternatives and similar packages

Based on the "HTTP" category.
Alternatively, view Ralitobu.Plug alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of Ralitobu.Plug or a related project?

Add another 'HTTP' Package

README

Ralitobu.Plug

A Plug for Ralitobu

Usage

# bucketize on remote IP, allow 10 req/s
plug Ralitobu.Plug, on_ip: true, limit: 10, lifetime: 1_000

Example

$ curl -i http://localhost:4000/

HTTP/1.1 200 OK
server: Cowboy
date: Sun, 24 Apr 2016 12:44:37 GMT
content-length: 12
cache-control: max-age=0, private, must-revalidate
ratelimit-limit: 3
ratelimit-remaining: 0
ratelimit-reset: 2

hello world
$ curl -i http://localhost:4000/

HTTP/1.1 429 Too Many Requests
server: Cowboy
date: Sun, 24 Apr 2016 12:44:38 GMT
content-length: 64
cache-control: max-age=0, private, must-revalidate
ratelimit-limit: 3
ratelimit-remaining: 0
ratelimit-reset: 1
retry-after: 1
content-type: application/json; charset=utf-8

{"status": 429, "error": "Too Many Requests", "retry_after": 1}