➲ What is a DDoS attack?
A denial-of-service attack (DoS attack) is a cyber-attack in which attackers request too many networks on the server and make services temporarily or indefinitely unavailable. Too many requests flood the targeted website or host into an overloaded system and prevent some or all of the legitimate requests from being met.
A distributed denial-of-service attack (DDoS attack), Dos attacks originate from a variety of sources. It is very difficult to stop an attack by blocking only one source.
You can prevent DDoS attacks by taking and implementing certain steps. Like buying unlimited bandwidth, protect your network infrastructure, buy using anti-DDOS attack hardware and software, and control the number of requests per unit.
➲ How to prevent denial of service attacks using Laravel Throttle
Laravel Throttle is a rate limiter for Laravel applications. A rate limiter is a process that checks for many requests at a given time by a user's session or IP, and HTTP status 429 responds to many more requests. A rate-limiting algorithm should be applied to the application to prevent DOS attacks.
You do not need to manually install throttle, the latest version of Laravel (from 5.2) includes throttle by default.
You can securely process your request by route group, for example:
Route::middleware('throttle:60,1')->group(function () {
Route::get('/', 'HomeController@dashboard');
Route::get('/users', UserController@list);
});
OR
Route::group(['middleware' => 'throttle:60,1'], function () {
Route::get('/', 'HomeController@dashboard');
Route::get('/users', UserController@list);
});