Global rate limit in discourse

AI-generated summary

A discussion on the Global rate limit in Discourse has been initiated by lmcthjo. They have upgraded Discourse to version 2.2.5 and want to increase the default rate limits (DISCOURSE_MAX_REQS_PER_IP_PER_MINUTE and DISCOURSE_MAX_REQS_PER_IP_PER_10_SECONDS) to prevent users from reaching the limit on the number of posts sent.

However, codinghorror suggests that the issue might be related to first-day user post count limits rather than the rate limit. lmcthjo provides an error message that confirms the rate limit is being hit.

codinghorror suspects a misconfigured reverse proxy, while Stephen recommends checking the profiles of affected users to verify their IP addresses.

lmcthjo reveals that the issue is caused by a user generating a large number of posts per minute via the user API key. weiwhy shares a similar experience and asks about modifying the global rate limit for a particular API. Unfortunately, sam responds that only a blanket API rate limit is available, with no option to customize limits per route.

Finally, riking points out that the limits can be modified in the site settings, specifically under the rate limits category.

Hi,

We have upgraded Discourse to version 2.2.5.
This is about limitations on the number of posts per user per day.

Our default setting is:
DISCOURSE_MAX_REQS_PER_IP_PER_MINUTE : number of requests per IP per minute (default is 200)
DISCOURSE_MAX_REQS_PER_IP_PER_10_SECONDS : number of requests per IP per 10 seconds (default is 50)

we would like to increase to:
DISCOURSE_MAX_REQS_PER_IP_PER_MINUTE : 1000
DISCOURSE_MAX_REQS_PER_IP_PER_10_SECONDS : 500

Do you think there is an impact on the discourse server and performance?
Because some users started to complain they reach the limit on the number of posts sent.

Thanks

I do not think this is the rate limit being discussed. Provide screenshots of the limiter being hit please or get more details.

It sounds like your users are running into first day user post count limits is my guess.

User gets error like:

01:09:42 {"errors":["You’ve performed this action too many times. Please wait 19 seconds before trying again."],"error_type":"rate_limit","extras":{"wait_seconds":19}}

That is indeed the Nginx per-IP rate limits, are you sure you are not behind a reverse proxy which is incorrectly sending all client IP addresses as the same IP address?

Is it always the same users? Are they trying to use the API?

If it’s not and they aren’t then check the profiles of some affected users, do their IPs look accurate? Are they all the same or similar? If so it’s either a misconfigured reverse proxy or something like Cloudflare being used with the orange cloud enabled without the template specified in the YML.

Yes they are using the same user, to generate a lot of posts per minute (via user API key).
But they now complain they are limited in terms of number of posts allowed for that user.

Do you think it could help if I increase:
DISCOURSE_MAX_REQS_PER_IP_PER_MINUTE : 1000
DISCOURSE_MAX_REQS_PER_IP_PER_10_SECONDS : 500

I had the same problem. I wanted to use the API, but it made such a mistake


I want to be able to set the rate of a particular API for admin
I don’t know how to modify the global rate
I’d appreciate it if you could tell me where it is
I come from china,so My English is bad, very sorry.

we only have a blanked API rate limit, no ability to customize limit per route.

The limits you’re looking for are in the site settings:

  • rate limit create topic
  • rate limit create post
  • rate limit new user create topic
  • rate limit new user create post

Go to https://discourse.example.com/admin/site_settings/category/rate_limits?filter=create to change these.