1.2 KiB
tip_number, date, category, status
| tip_number | date | category | status |
|---|---|---|---|
| 44 | 2026-07-25 | security | pending |
Tip #44 — Rate-Limit server functions
Date: 2026-07-25
Category: security
Source: MC-Survival Wiki Daily Tip (cron @ 18:00 MESZ)
Rate-Limit server functions
Apply a token-bucket rate limit per IP to anonymous server functions — for example 60 req/min on search and 10 req/min on write endpoints — and return a 429 with a Retry-After header when the limit is hit. It solves the abuse problem: search, item-pick, and any anonymous write endpoint are obvious targets for scripted abuse, scraping, and accidental loops. The signal is operational: TanStack Start server functions are publicly callable by default, and there is no rate limiting in front of them today, which is fine at 100 users and a real problem at 10,000. An in-memory bucket per server instance is the right starting point — switching to Redis later is a one-function change when multi-instance scale arrives.
Implementation tips
- Token-bucket per IP for unauthenticated routes. 60 req/min for search, 10 req/min for writes.
- In-memory bucket per server instance is fine for small scale; Redis later when multi-instance.
- Return 429 with Retry-After header — don't silently drop.