GamendWeb.Plugs.RateLimiter (gamend_web v1.0.1216)

Copy Markdown View Source

Plug that rate-limits incoming HTTP requests per client IP.

Uses GamendWeb.RateLimit (Hammer ETS backend) to enforce configurable limits per time window. Different path prefixes can have different limits (e.g. auth endpoints are stricter).

Configuration

config :gamend_web, GamendWeb.Plugs.RateLimiter,
  general_limit: 1200,         # requests per window
  general_window: 60_000,     # 60 seconds
  auth_limit: 30,             # login/registration
  auth_window: 60_000

Responds with 429 Too Many Requests when the limit is exceeded.

Summary

Functions

call(conn, opts)

init(opts)