ุงูุณูุงู
ุนูููู
๐
ูู ุงูู
ูุงูุฉ ุฏู ูุชููู
ุนู ุงู RateLimiter ูู ูุงุฑููู ู ุฅุฒุงู ุฃุดุชุบู ุจูู ู ุฅูู ูุงูุฏุชู โฑ
ุนุดุงู ูุจุฏุก ูุดุชุบู ุจุงู RateLimiter ูู ูุงุฑููู, ูุฑูุญ ููุชุญ ูุงูู ุงู RouteServiceProvider ูููุงูู ู
ูุซูุฏ ุฅุณู
ูุง configureRateLimiting ู ุฌูุง ุงูู
ูุซูุฏ ุฏู ูู RateLimiter ุฎุงุต ุจุงู api ู ุทุจุนุงู ููุฏุฑ ูุถูู RateLimiters ุฎุงุตุฉ ุจููุง ุฒู ุงูููุฏ ุงููู ุฌุงู ุฏุง ๐ง
/**
* Configure the rate limiters for the application.
*
* @return void
*/
protected function configureRateLimiting()
{
RateLimiter::for('ratelimiter', function () {
return Limit::perMinute(10);
});
RateLimiter::for('api', function (Request $request) {
return Limit::perMinute(60)->by(optional($request->user())->id ?: $request->ip());
});
}
ู ุฒู ู
ุง ูุงุถุญ ูู ุงูููุฏ ุฏุง ุฅูู ุถูุช RateLimiter ุฅุณู
ู ratelimiter, ู ุจุงููุณุจุฉ ูุณุทุฑ ุงูููุฏ ุงููู ูู ุงู Closure ูุดุฑุญู ุจุนุฏูู ๐
ู ุนุดุงู ุฃุณุชูุงุฏ ุจุงู ratelimiter ุงููู ุถูุชู ูู ุนูุฏู ุทุฑููุชูู ู
ู
ูู ุฃุณุชุฎุฏู
ุฃู ูุงุญุฏุฉ ูููู
๐
ุฃูู ุทุฑููุฉ ู
ู
ูู ุฃุณุชุฎุฏู
ู ู
ู ุฌูุง ุงู RouteServiceProvider ู ูุฑูุญ ูู
ูุซูุฏ ุงู boot ูุถูู throttle:ratelimiter ุฒู ุงูููุฏ ุงููู ุฌุงู ุฏุง ๐
/**
* Define your route model bindings, pattern filters, etc.
*
* @return void
*/
public function boot()
{
$this->configureRateLimiting();
$this->routes(function () {
Route::prefix('api')
->middleware('api')
->namespace($this->namespace)
->group(base_path('routes/api.php'));
Route::middleware(['web', 'throttle:ratelimiter'])
->namespace($this->namespace)
->group(base_path('routes/web.php'));
});
}
ุชุงูู ุทุฑููุฉ ุฅูู ุฃุถูููุง ุนูู ุงู Route ููุณู ุฒู ุงูููุฏ ุงููู ุฌุงู ุฏุง ๐
use Illuminate\Support\Facades\Route;
Route::view('/', 'welcome')->middleware('throttle:ratelimiter');
ุทูุจ ุฅูู ู
ุนูู ุงู RateLimiter, ููู ุฅุณุชุฎุฏู
ูุง ู
ูุซูุฏ ุฅุณู
ูุง perMinute ู ู
ุฑุฑูุง ูููุง ุฑูู
10, ุงูุณุทุฑ ุฏุง ู
ุนูุงู ุฅูู ูุณู
ุญ ุจ 10 ุฑูููุณุชุงุช ูู ุงูุฏูููุฉ ุงููุงุญุฏุฉ ุจุณ, ููู
ุง ุฃุฒูุฑ ุงู '/' ูุฃุนู
ู ุฑูุฑูุด ุฃูุชุฑ ู
ู 10 ู
ุฑุงุช ูู ุงูุฏูููุฉ ููุทูุน ุฅูุณุจุดู ุจูููู ุฅูู ุชุฌุงูุฒุช ุงูุนุฏุฏ ุงูู
ูุญุฏุฏ ููุง ๐ซ
ุทุจ ุงูููุงู
ุฏุง ู
ูู
ูููุ ๐ค
ุงูููุงู
ุฏุง ู
ูู
ุนุดุงู ุฃู
ูุน ุญุงุฌุฉ ุฅุณู
ูุง DDOS ๐ธ
ู ุจูุฏุง ุฃููู ุฎูุตุช ู ุฃุชู
ูู ุชููู ุฅุณุชูุฏุช โ