About Features Downloads Getting Started Documentation Events Support GitHub

Love VuFind®? Consider becoming a financial supporter. Your support helps build a better VuFind®!

Site Tools


Warning: This page has not been updated in over over a year and may be outdated or deprecated.
administration:rate_limiting

Rate Limiting

General

Rate limiting can be used to limit the number of requests allowed e.g. within a given time window.

Beginning with version 10.0 VuFind® has integrated support for rate limiting of requests. The system allows one to provide generic rate limits per IP address or user (for logged-in users), and there's a lot of flexibility in defining separate rates for different actions, IP ranges, bots etc.

Rate limiting is configured via RateLimiter.yaml, and it's disabled by default. It can be configured to enforce limits or just log them for setup validation. There's also a policy-specific toggle to allow testing a new policy without it taking effect immediately. RateLimiter.yaml contains comments explaining the different configuration options.

Note that VuFind's rate limiter does not govern requests that are handled by Apache without going through PHP. Typically these are requests for css files, images, fonts etc.

Storage

Rate limiting needs a storage for the state information. Typically this would be a Memcached or Redis instance, so either one is required for proper setup. While the code allows one to use VuFind's file-based cache as well, it's only for testing purposes and is not supported for normal operation.

Policies

Rate limiter uses the Symfony Rate Limiter under the hood. Symfony's documentation provides an introduction to the available policies and describes the options for their configuration. Only the policy-specific part of the configuration applies to VuFind. Other bits are specific to Symfony framework.

The examples in the default RateLimiter.yaml are just that, and you will need to figure out suitable rates for different functions. You could consider e.g. a catch-all policy to provide a generic rate limit while adding stricter limits for some functions such as search, login or API access.

administration/rate_limiting.txt · Last modified: 2024/05/16 10:53 by emaijala