在Laravel中禁用速率限制器? [英] Disable rate limiter in Laravel?

查看:145
本文介绍了在Laravel中禁用速率限制器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Laravel中是否可以禁用每条/每条路线上的速率限制?

Is there a way to disable rate limiting on every/individual routes in Laravel?

我正在尝试测试接收到大量请求的终结点,但是Laravel会随机以{ status: 429, responseText: 'Too Many Attempts.' }响应数百个请求,这使得测试非常痛苦.

I'm trying to test an endpoint that receives a lot of requests, but randomly Laravel will start responding with { status: 429, responseText: 'Too Many Attempts.' } for a few hundred requests which makes testing a huge pain.

推荐答案

app/Http/Kernel.php中,Laravel对所有api路由都有默认的油门限制.

In app/Http/Kernel.php Laravel has a default throttle limit for all api routes.

protected $middlewareGroups = [
    ...
    'api' => [
        'throttle:60,1',
    ],
];

评论或增加它.

这篇关于在Laravel中禁用速率限制器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆