Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Increase X-RateLimit-Limit in laravel using throttle middleware

I can find ways to decrease the value but in my case I am running many asynchronous API calls and need to increase the X-RateLimit-Limit to something more than 100 to work.

Kindly suggest alternatives.

following is the response which I am getting

P.S - I am using auth middleware also


eHTTP/1.1 429 Too Many Requests

Date: Fri, 10 Mar 2017 11:18:24 GMT Server: Apache/2.4.17 (Win32) OpenSSL/1.0.2d PHP/5.5.35 X-Powered-By: PHP/5.5.35 Cache-Control: no-cache X-RateLimit-Limit: 60 X-RateLimit-Remaining: 0 Retry-After: 24 Set-Cookie: XSRF-TOKEN=eyJpdiI6ImtuSU5EMXo0YXlrSU1MWnVnUFRyeUE9PSIsInZhbHVlIjoicVVkMU55V2lkcHNvMkRqaFlCUFZnK3lcL0pRckNpcjMyZll3UkVaWXNEYWhSazdcL2Jub3M4QmtpZDhDQWVCZjhzWE5KV0paaGlZMGJOQ1J1TGNFYnhkdz09IiwibWFjIjoiZTNlNzY3MDc2ZWExMjBhZDI0MjA3NzNjYjE5YWU1NmIzZmEyY2RiOWI4NDBmOGI5MjVmN2E2ZTUzNDE3YjdmNyJ9; expires=Fri, 10-Mar-2017 13:18:25 GMT; Max-Age=7200; path=/ Set-Cookie: laravel_session=eyJpdiI6IkRoSWV2dzFHV3F5YUJNR2tCMEhKSUE9PSIsInZhbHVlIjoiTzdhOW12ZFozNnJtaW5vRFBHdFVZV1l2SDdXcEpvdEN6MGdRTkZsRzFoeU9yb2VXTDN5cVA0a1d5NnZ1MCtEMTRKNFRES1ZsODg5YmswY2F5cEN0c1E9PSIsIm1hYyI6ImY5YjYyMmNiNDE1YzgxYmQ3NzE5NjYyMTk0YmEzNzU2NTg4MzZhZWYyNDVjMWVkMzJmNzRiMmUwODFjYjRiYWMifQ%3D%3D; expires=Fri, 10-Mar-2017 13:18:25 GMT; Max-Age=7200; path=/; httponly Content-Length: 18 Keep-Alive: timeout=5, max=99 Connection: Keep-Alive Content-Type: text/html; charset=UTF-8

Too Many Attempts.

like image 900
Vishal Pandey Avatar asked Jan 05 '23 09:01

Vishal Pandey


2 Answers

You can set throttling parameters as in the image:

enter image description here

like image 108
Jakub Kratina Avatar answered Jan 07 '23 15:01

Jakub Kratina


Your attempt to do set the API thottle greater than 60 like the following will be usurped by the setting in app/Http/Kernel.php:

// routes/api.php
Route::get('myapi/{value}/{anothervalue}', 'MyApiController@getStuff')->middleware('throttle:100,1');

For the above to work, increase the limit in app/Http/Kernel.php according to your specific requirements:

    'api' => [
        'throttle:500,1',
        'bindings',
    ],
like image 22
STWilson Avatar answered Jan 07 '23 17:01

STWilson