Skip to content

Add support for API rate limiting (requests per time frame) #647

Open
@Kaliumhexacyanoferrat

Description

@Kaliumhexacyanoferrat

As a developer of a web service, I would like to limit the number of requests per time frame (e.g. per five minutes), so that consumers cannot spam or scrape my API.

Example

var limit = RateLimit.Allow(60)
                     .Per(Duration.FromMinutes(5))
                     .By(r => r.GetUser<IUser>());

myApi.Add(limit);

Acceptance criteria

  • The functionality is implemented in a rate limiting module
  • The change is in general compatible with Rate limiting / throttling of response downloads #352
  • The user can decide on what property the rate limiting is applied (e.g. per IP, per user, per API key, per ...)
  • For typical use cases, convenience methods are provided (e.g. ByIP(), ByUser())
  • The feature is documented on the GenHTTP website
  • The feature is covered by acceptance tests

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions