Skip to content

API rate limit setting not being applied #311

@mtout

Description

@mtout

While trying to increase the rate limit by using the CACHET_API_RATE_LIMIT env variable and checking the X-RateLimit-Limit header, I noticed it didn't set and apply the configured value nor the default value of 300.
Instead, it's always 60.

Diving into the code, I found out the following.
The middleware set for the api routes are cachet:api and throttle:cachet-api (in CachetCoreServiceProvider).
throttle:cachet-api seems to be correct and I see the config setting being applied.

cachet:api on the other hand configures middleware according to the config cachet.api_middleware. That one is 'api'.
In AppServiceProvider a RateLimiter is set for the name 'api'. Not sure how that ends up in that middleware group, but it does.
That RateLimiter is set to 60 attempts per minute and that's what's limiting it and returned in the headers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions