GameServerWeb.Plugs.RateLimiter (game_server_web v1.0.943)

Copy Markdown

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

Uses GameServerWeb.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 :game_server_web, GameServerWeb.Plugs.RateLimiter,
  general_limit: 120,          # requests per window
  general_window: 60_000,     # 60 seconds
  auth_limit: 10,             # login/registration
  auth_window: 60_000

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

Summary

Functions

call(conn, opts)

init(opts)