Context
Abuse needs stopping at two points: at the edge before it costs compute, and in the app where the caller’s identity and plan are known.Decision
- Cloudflare WAF and rate rules guard the edge against volumetric and unauthenticated abuse.
- The application enforces token buckets per tenant, per token and per endpoint class, keyed on authenticated identity.
- A limited call returns
429withRetry-After. - Bucket sizes and plan-based limits: TODO; they tie to tenant entitlements, which are decided separately.
Consequences
- Two layers to configure; edge rules are outside the Encore app.