From 138866e9308f8c460a251e478d06503f7788318b Mon Sep 17 00:00:00 2001 From: jwdeitch Date: Thu, 28 Jul 2016 12:20:43 -0400 Subject: [PATCH] rate limit: Limit should apply to all routes Exceeding the rate limit should return 403 for all further requests; the route of the request should not matter. The current behavior is such that exceeding the rate limit will only 403 that particular route. --- src/Http/RateLimit/Handler.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Http/RateLimit/Handler.php b/src/Http/RateLimit/Handler.php index 71c07bbe5..f5efe8e4f 100644 --- a/src/Http/RateLimit/Handler.php +++ b/src/Http/RateLimit/Handler.php @@ -103,8 +103,6 @@ public function rateLimitRequest(Request $request, $limit = 0, $expires = 0) } elseif ($limit > 0 || $expires > 0) { $this->throttle = new Route(['limit' => $limit, 'expires' => $expires]); - $this->keyPrefix = md5($request->path()); - // Otherwise we'll use the throttle that gives the consumer the largest // amount of requests. If no matching throttle is found then rate // limiting will not be imposed for the request. @@ -171,7 +169,7 @@ protected function getMatchingThrottles() */ protected function key($key) { - return sprintf('dingo.api.%s.%s.%s', $this->keyPrefix, $key, $this->getRateLimiter()); + return sprintf('dingo.api.%s.%s', $key, $this->getRateLimiter()); } /**