Skip to content

Rate limiting

Rate limiting is per-app, configured with simpledeploy.ratelimit.* labels on any service in the compose file.

Label Default Description
simpledeploy.ratelimit.requests none Allowed requests per window. Rate limiting is on only when this is set
simpledeploy.ratelimit.window 60s Length of the window
simpledeploy.ratelimit.burst 0 Extra requests allowed in a short spike, on top of requests
simpledeploy.ratelimit.by ip Key to bucket by: ip, header:NAME, or path

requests/window define the steady rate. burst lets a client briefly go over it: once a window’s requests are used up, up to burst more get through. A client that keeps going over is held to requests per window; the burst comes back after it stays within requests (or sends nothing) for a whole window. Without burst, the limit is exactly requests per window. Once nothing is left, clients get 429 Too Many Requests with a Retry-After: 60 header.

services:
web:
image: myapp:latest
labels:
simpledeploy.endpoints.0.domain: "myapp.example.com"
simpledeploy.endpoints.0.port: "3000"
simpledeploy.ratelimit.requests: "100"
simpledeploy.ratelimit.window: "60s"
simpledeploy.ratelimit.burst: "20"
simpledeploy.ratelimit.by: "ip"

100 req/min/IP. A short spike can reach 120 in one minute; a client that keeps going over is held to 100 a minute.

labels:
simpledeploy.ratelimit.requests: "1000"
simpledeploy.ratelimit.window: "60s"
simpledeploy.ratelimit.by: "header:X-API-Key"

Each unique X-API-Key value gets its own bucket. Requests with no header share one bucket. Use a header name made of letters, digits and - only: the proxy drops headers whose names contain _ or ., so such a header never arrives and every request lands in the shared bucket.

labels:
simpledeploy.ratelimit.requests: "10"
simpledeploy.ratelimit.window: "10s"
simpledeploy.ratelimit.by: "path"

Useful for hot endpoints like /login or /search where you want to keep one path from starving others.

For admin or internal-only paths, put the app behind an IP allowlist with IP access control and skip rate limiting entirely.

See also: Compose labels, Configuration.