public function handle(Request $request, Closure $next): Response { $ua = $request->header('User-Agent', ''); // 1. Google & Bing: Absolut KEIN Limit (Volle Pulle) // Diese Bots steuern deinen Traffic. Wenn die CPU bei 7% ist, // können die auch mit 100 Requests/Sekunde kommen. if (str_contains($ua, 'Googlebot') || str_contains($ua, 'bingbot') || str_contains($ua, 'DuckDuckBot')) { return $next($request); } // 2. KI-Bots: Sehr großzügig (600/Min) // Claude & GPT bringen (noch) wenig Klicks, aber sollen die Daten kennen. if (str_contains($ua, 'ClaudeBot') || str_contains($ua, 'GPTBot')) { $key = 'ai-bot:' . $request->ip(); if (RateLimiter::tooManyAttempts($key, 600)) { return response()->json(['error' => 'AI cooling down.'], 429); } RateLimiter::hit($key, 60); return $next($request); } // 3. Der Rest (SEO-Tools & Scraper): Moderat (60/Min) if ( str_contains($ua, 'AhrefsBot') || str_contains($ua, 'SemrushBot') || str_contains($ua, 'Bytespider') || str_contains($ua, 'YandexBot') ) { $key = 'scraper-bot:' . $request->ip(); if (RateLimiter::tooManyAttempts($key, 60)) { return response()->json(['error' => 'Slow down!'], 429); } RateLimiter::hit($key, 60); } return $next($request); } public function handle(Request $request, Closure $next): Response { $ua = $request->header('User-Agent', ''); // 1. Google & Bing: Absolut KEIN Limit (Volle Pulle) // Diese Bots steuern deinen Traffic. Wenn die CPU bei 7% ist, // können die auch mit 100 Requests/Sekunde kommen. if (str_contains($ua, 'Googlebot') || str_contains($ua, 'bingbot') || str_contains($ua, 'DuckDuckBot')) { return $next($request); } // 2. KI-Bots: Sehr großzügig (600/Min) // Claude & GPT bringen (noch) wenig Klicks, aber sollen die Daten kennen. if (str_contains($ua, 'ClaudeBot') || str_contains($ua, 'GPTBot')) { $key = 'ai-bot:' . $request->ip(); if (RateLimiter::tooManyAttempts($key, 600)) { return response()->json(['error' => 'AI cooling down.'], 429); } RateLimiter::hit($key, 60); return $next($request); } // 3. Der Rest (SEO-Tools & Scraper): Moderat (60/Min) if ( str_contains($ua, 'AhrefsBot') || str_contains($ua, 'SemrushBot') || str_contains($ua, 'Bytespider') || str_contains($ua, 'YandexBot') ) { $key = 'scraper-bot:' . $request->ip(); if (RateLimiter::tooManyAttempts($key, 60)) { return response()->json(['error' => 'Slow down!'], 429); } RateLimiter::hit($key, 60); } return $next($request); } public function handle(Request $request, Closure $next): Response { $ua = $request->header('User-Agent', ''); // 1. Google & Bing: Absolut KEIN Limit (Volle Pulle) // Diese Bots steuern deinen Traffic. Wenn die CPU bei 7% ist, // können die auch mit 100 Requests/Sekunde kommen. if (str_contains($ua, 'Googlebot') || str_contains($ua, 'bingbot') || str_contains($ua, 'DuckDuckBot')) { return $next($request); } // 2. KI-Bots: Sehr großzügig (600/Min) // Claude & GPT bringen (noch) wenig Klicks, aber sollen die Daten kennen. if (str_contains($ua, 'ClaudeBot') || str_contains($ua, 'GPTBot')) { $key = 'ai-bot:' . $request->ip(); if (RateLimiter::tooManyAttempts($key, 600)) { return response()->json(['error' => 'AI cooling down.'], 429); } RateLimiter::hit($key, 60); return $next($request); } // 3. Der Rest (SEO-Tools & Scraper): Moderat (60/Min) if ( str_contains($ua, 'AhrefsBot') || str_contains($ua, 'SemrushBot') || str_contains($ua, 'Bytespider') || str_contains($ua, 'YandexBot') ) { $key = 'scraper-bot:' . $request->ip(); if (RateLimiter::tooManyAttempts($key, 60)) { return response()->json(['error' => 'Slow down!'], 429); } RateLimiter::hit($key, 60); } return $next($request); } public function handle(Request $request, Closure $next): Response { $ua = $request->header('User-Agent', ''); // 1. Google & Bing: Absolut KEIN Limit (Volle Pulle) // Diese Bots steuern deinen Traffic. Wenn die CPU bei 7% ist, // können die auch mit 100 Requests/Sekunde kommen. if (str_contains($ua, 'Googlebot') || str_contains($ua, 'bingbot') || str_contains($ua, 'DuckDuckBot')) { return $next($request); } // 2. KI-Bots: Sehr großzügig (600/Min) // Claude & GPT bringen (noch) wenig Klicks, aber sollen die Daten kennen. if (str_contains($ua, 'ClaudeBot') || str_contains($ua, 'GPTBot')) { $key = 'ai-bot:' . $request->ip(); if (RateLimiter::tooManyAttempts($key, 600)) { return response()->json(['error' => 'AI cooling down.'], 429); } RateLimiter::hit($key, 60); return $next($request); } // 3. Der Rest (SEO-Tools & Scraper): Moderat (60/Min) if ( str_contains($ua, 'AhrefsBot') || str_contains($ua, 'SemrushBot') || str_contains($ua, 'Bytespider') || str_contains($ua, 'YandexBot') ) { $key = 'scraper-bot:' . $request->ip(); if (RateLimiter::tooManyAttempts($key, 60)) { return response()->json(['error' => 'Slow down!'], 429); } RateLimiter::hit($key, 60); } return $next($request); }