Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify Rate-Limit System: Unify to a Single x/hour Limit with Standard Headers #59

Open
Zingzy opened this issue Feb 15, 2025 · 0 comments
Assignees
Labels
backend Changes related to Backand/API documentation Improvements or additions to documentation priority: high High priority tasks

Comments

@Zingzy
Copy link
Member

Zingzy commented Feb 15, 2025

We propose refactoring our existing rate-limit system for endpoints that already enforce rate limits. Instead of our current multi-dimensional limits, we want to unify these to a single, configurable limit (denoted as "x" requests per hour, with the exact value to be decided later). This change will apply only to endpoints that currently have an existing rate limit, leaving endpoints without limits unchanged.

Additionally, we need to externalize all rate limit configuration settings to a separate config file (e.g., a .env file) rather than hardcoding them in the codebase. This will make adjustments easier across different environments and improve maintainability.

Proposed Changes:

  • Unified Limit for Selected Endpoints:

    • For endpoints that already have a rate limit, enforce a unified limit of "x" requests per hour (value to be determined later).
  • Standardized Rate-Limit Headers:

    • Ensure that every response from these endpoints includes:
      • X-RateLimit-Limit: Total allowed requests (e.g., "x").
      • X-RateLimit-Remaining: Requests remaining in the current window.
      • X-RateLimit-Reset: Time until the limit resets.
      • Optionally, a Retry-After header when the limit is exceeded.
  • Externalized Configuration

    • Move all rate limit configuration (limits, window durations, etc.) to a separate config file (e.g., .env) rather than hardcoding these values.
@Zingzy Zingzy added backend Changes related to Backand/API documentation Improvements or additions to documentation priority: high High priority tasks labels Feb 15, 2025
@Zingzy Zingzy added this to the Core Feature Enhancements milestone Feb 15, 2025
@Zingzy Zingzy self-assigned this Feb 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Changes related to Backand/API documentation Improvements or additions to documentation priority: high High priority tasks
Projects
Status: No status
Development

When branches are created from issues, their pull requests are automatically linked.

1 participant