Solved it. I turned of caching in my local testing environment and apparently Laravel's rate limiting function uses the cache to work. So setting CACHE_DRIVER=file in my local .env file worked.
Mar 27, 2022
1
Level 1
API throttling
Hi everyone,
I'm trying to implement throttling on my Laravel (8) API backend. I use Sanctum sessions for authentication. I followed the official docs and I can see that the correct rate limit (5 per Minute for testing) is being sent in the response headers. The problem is, subsequent requests are not being counted. So every response headers looks like this:
X-RateLimit-Limit=5
X-RateLimit-Remaining=5
Obviously throttling won't work and I can send as many requests as I please. Any ideas how I could fix this?
Level 1
Please or to participate in this conversation.