Страница 1 из 1

Помогите настроить rateLimit

Добавлено: 2014.08.22, 13:59
aquy
В behaviors вставляю

Код: Выделить всё

'rateLimiter' => [
                'class' => \yii\filters\RateLimiter::className(),
                'only' => ['index'],
                'enableRateLimitHeaders' => true,
                'errorMessage' => 'Превышен лимит обращений',
            ],
а где сами лимиты писать не совсем понимаю.

Плюс из документации следует что лимиты можно прописать для идентифицированных пользователей, а для гостей получается нельзя?

Re: Помогите настроить rateLimit

Добавлено: 2014.08.28, 13:25
Nafania
http://www.yiiframework.com/doc-2.0/yii ... miter.html
When the user has exceeded his rate limit, RateLimiter will throw a yii\web\TooManyRequestsHttpException exception.

Note that RateLimiter requires $user to implement the yii\filters\RateLimitInterface. RateLimiter will do nothing if $user is not set or does not implement yii\filters\RateLimitInterface.
http://www.yiiframework.com/doc-2.0/yii ... rface.html