Skip to content

Commit

Permalink
Add ratelimits to default config
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelfolaron committed Jun 11, 2024
1 parent d670a27 commit 6bc3e8e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 15 additions & 0 deletions app/Core/DefaultConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -476,4 +476,19 @@ class DefaultConfig
* @var string trusted Proxies
*/
public string $trustedProxies = '127.0.0.1,REMOTE_ADDR';

/**
* @var int rate limit on all requests
*/
public int $ratelimitGeneral = 2000;

/**
* @var int rate limit on api requests
*/
public int $ratelimitApi = 10;

/**
* @var int rate limit on auth requests
*/
public int $rateLimitAuth = 20;
}
2 changes: 1 addition & 1 deletion app/Core/Middleware/RequestRateLimiter.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public function handle(IncomingRequest $request, Closure $next): Response
}

$key = self::dispatch_filter(
"rateLimit",
"rateLimitKey",
$key,
[
"bootloader" => $this,
Expand Down

0 comments on commit 6bc3e8e

Please sign in to comment.