Make API rate limit configurable via environment variables #1203
dacopan
started this conversation in
Feature requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Summary
Currently the
apirate limiter is hardcoded inAppServiceProvider::boot():For self-hosted instances that need a different throughput (e.g. bulk data imports/exports, integrations polling the API on a schedule, larger teams), the only way to change this today is patching the source and maintaining a custom build.
Proposal
Make these two values configurable via environment variables, keeping the current values as defaults so behavior is unchanged for anyone who doesn't set them:
API_RATE_LIMIT_AUTH_PER_MINUTE(default:200) — limit for authenticated requestsAPI_RATE_LIMIT_GUEST_PER_MINUTE(default:60) — limit for unauthenticated/IP-based requestsImplementation would follow Laravel conventions (reading from a
config/rate-limiting.phpfile rather than callingenv()directly inside the service provider, so it stays compatible withconfig:cache):This is fully backward-compatible (defaults match current hardcoded values) and would also be documented in
.env.example.Why
Self-hosted users currently have no way to tune API throughput without forking and maintaining a custom Docker build. This is a small, low-risk change that only affects behavior for instances that explicitly opt in via env vars.
Happy to open a PR for this if the approach sounds good — wanted to check in first given the contribution guidelines.
All reactions