mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Rate limiter for 404's
This commit is contained in:
parent
4e8c603d3a
commit
446fb59b5b
@ -32,7 +32,7 @@ class QueryLogging
|
|||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function handle(Request $request, Closure $next)
|
public function handle(Request $request, Closure $next)
|
||||||
{
|
{nlog("yoyo");
|
||||||
// Enable query logging for development
|
// Enable query logging for development
|
||||||
if (! Ninja::isHosted() || ! config('beacon.enabled')) {
|
if (! Ninja::isHosted() || ! config('beacon.enabled')) {
|
||||||
return $next($request);
|
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);
|
abort(404);
|
||||||
|
|
||||||
});
|
})->middleware('throttle:404');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user