mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-13 22:54:25 +01:00
Rate limiter for 404's
This commit is contained in:
parent
4e8c603d3a
commit
446fb59b5b
@ -32,7 +32,7 @@ class QueryLogging
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle(Request $request, Closure $next)
|
||||
{
|
||||
{nlog("yoyo");
|
||||
// Enable query logging for development
|
||||
if (! Ninja::isHosted() || ! config('beacon.enabled')) {
|
||||
return $next($request);
|
||||
|
@ -78,6 +78,14 @@ class RouteServiceProvider extends ServiceProvider
|
||||
}
|
||||
});
|
||||
|
||||
RateLimiter::for('404', function (Request $request) {
|
||||
if (Ninja::isSelfHost()) {
|
||||
return Limit::none();
|
||||
} else {
|
||||
return Limit::perMinute(25)->by($request->ip());
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -158,4 +158,4 @@ Route::fallback(function () {
|
||||
|
||||
abort(404);
|
||||
|
||||
});
|
||||
})->middleware('throttle:404');
|
||||
|
Loading…
Reference in New Issue
Block a user