From 24856100d7475e5c6ddf257508ef523b0c1816c4 Mon Sep 17 00:00:00 2001 From: esyede Date: Sat, 5 Oct 2024 02:45:42 +0700 Subject: [PATCH] Throttle: cloudflare connecting ip --- system/routing/throttle.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system/routing/throttle.php b/system/routing/throttle.php index 3cbad1d7..f3524602 100644 --- a/system/routing/throttle.php +++ b/system/routing/throttle.php @@ -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); } @@ -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()); } /**