Alan Guo Xiang Tan 859d61003e
DEV: API to register custom request rate limiting conditions (#30239)
This commit adds the `add_request_rate_limiter` plugin API which allows plugins to add custom rate limiters on top of the default rate limiters which requests by a user's id or the request's IP address.

Example to add a rate limiter that rate limits all requests from Googlebot under the same rate limit bucket:

```
add_request_rate_limiter(
  identifier: :country,
  key: ->(request) { "country/#{DiscourseIpInfo.get(request.ip)[:country]}" },
  activate_when: ->(request) { DiscourseIpInfo.get(request.ip)[:country].present? },
)
```
2024-12-23 09:57:18 +08:00
..
2022-04-28 11:51:03 +02:00
2024-08-12 10:41:13 +02:00
2024-11-06 06:27:49 +08:00
2023-02-21 10:30:48 +01:00
2024-07-04 10:58:21 +02:00
2020-07-21 15:55:03 +08:00
2024-12-19 13:22:05 -03:00