gateway.push.redis and every replica of your gateway shares one brute-force budget, so max_attempts on login and approval is a cluster-wide total β not a per-replica one.
Quick Start
1
Single replica β nothing to do
One gateway process already enforces the limits correctly with the in-process
AuthRateLimiter.2
Multiple replicas β set gateway.push.redis
The auth limiters pick up the gatewayβs push Redis automatically. There is no extra knob.
3
Or wire it in Python
Pass a
RedisConfig on GatewayConfig.push where you construct the gateway.On a 3-replica gateway, the magic-link budget of 5 attempts is now 5 in total. Without Redis it is roughly 15 β 5 per replica.
How It Works
Every attempt runs one atomic Lua script on Redis: check the lockout key,INCR the bucket, set its window TTL, and set a lockout once the budget is exceeded. All replicas hit the same keys, so counts never race.
Covered endpoints
Keys are namespaced as
{prefix}authrl:{endpoint}:{identity}:b (bucket) and {prefix}authrl:{endpoint}:{identity}:l (lockout), where {prefix} is push.redis.prefix (default praison:push:). Both expire via Redis TTLs, so nothing needs pruning.
Redis Outage Behaviour
The limiter never fails open. If Redis is unreachable it falls back to a local per-replica limiter, so per-replica limits still apply.Configuration Options
The limiter reuses the gatewayβs pushRedisConfig β no separate auth-limiter Redis knob.
Deliberately out of scope β these stay per-replica by design:
UnauthorizedFloodGuardβ per-connection; a connection only lives on one replica.PreauthConnectionBudgetβ guards each replicaβs own socket resources.PairingStoreβs in-chat lockout β built in many bot constructors without gateway config; gateway pairing HTTP routes are already covered through_approval_rate.
Best Practices
Enable it with the turn lock and idempotency
Enable it with the turn lock and idempotency
On a multi-replica gateway, the same
push.redis block also backs the turn lock and the idempotency store. Configure all three together so every piece of shared state is cluster-wide.Reuse the gateway's push RedisConfig
Reuse the gateway's push RedisConfig
The auth limiter auto-shares
push.redis. Configure Redis once; do not duplicate the connection.Remember local lockouts outlive outages
Remember local lockouts outlive outages
A lockout earned against the local fallback stays in force after Redis comes back, so a locked-out IP stays locked out until its local lockout expires.
Related
Gateway Turn Lock
Sibling shared state β a distributed lease that serialises a sessionβs turns.
Cross-Replica Idempotency
Sibling shared state β exactly-once webhook admission on the same Redis.
Redis Pub/Sub Resilience
Same Redis β reconnect and outage surfacing for cross-instance delivery.
Gateway Edge Protections
The per-replica guards that stay in-process by design.

