Multiple ajax request server response become 403 forbidden, Laravel

Viewed 204

I built a pos application in Laravel and hosted it on a shared hosting server. on the live server when I try to send ajax request multiple times to add products from the right side pane(by clicking image one after one) it starts responding 403 forbidden after some request.

enter image description here

Any help, what I can do to prevent this, and what is the cause?

1 Answers

The reason behind the 403 is that laravel reject request if default request limit is reached out of limit. You can set the number of requests per min as per your project in app/Http/Kernel.php.

 'api' => [
            'throttle:150,1', // 150 requests per min
            \Illuminate\Routing\Middleware\SubstituteBindings::class,
        ],
Related