Skip to content

Commit

Permalink
Throttle: cloudflare connecting ip
Browse files Browse the repository at this point in the history
  • Loading branch information
esyede committed Oct 4, 2024
1 parent 93a2b12 commit 2485610
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions system/routing/throttle.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public static function check($max_attempts, $decay_minutes = 1)
'reset' => time() + ($decay_minutes * 3600),
'retry' => $decay_minutes * 3600,
'key' => $key,
'ip' => Request::ip(),
'ip' => Request::server('HTTP_CF_CONNECTING_IP') ?: Request::ip(),
];
Cache::put($key, $data, $decay_minutes);
}
Expand Down Expand Up @@ -79,7 +79,7 @@ public static function exceeded($max_attempts, $decay_minutes)
*/
public static function key()
{
return static::PREFIX . '.' . RAKIT_KEY . '.' . md5(Request::ip());
return static::PREFIX . '.' . RAKIT_KEY . '.' . md5(Request::server('HTTP_CF_CONNECTING_IP') ?: Request::ip());
}

/**
Expand Down

0 comments on commit 2485610

Please sign in to comment.