Nex.RateLimit.Plug (nex_core v0.4.3)

Copy Markdown

Plug middleware that applies rate limiting based on client IP.

Usage

Application.put_env(:nex_core, :plugs, [
  {Nex.RateLimit.Plug, max: 100, window: 60}
])

Returns HTTP 429 with a JSON error body when the limit is exceeded. Adds X-RateLimit-Limit and X-RateLimit-Remaining response headers.

Summary

Functions

call(conn, opts)

init(opts)