AspNetCoreRateLimit icon indicating copy to clipboard operation
AspNetCoreRateLimit copied to clipboard

How can I disable rate limiting for google bots?

Open HolyOne opened this issue 2 years ago • 1 comments

Is there a way to disable or override rate limit by user agent?

HolyOne avatar Jun 09 '23 05:06 HolyOne

You can do this by utilizing the client ID and client whitelist:

  1. Use the config to set something like "ClientIdHeader": "x-is-whitelisted" and "ClientWhitelist": [ "yes" ]
  2. Add your user agent check before rate limiting is applied.
  3. Set the request header of every request to "yes" or "no".

You should set (and overwrite) this header for every request, so that a spoofed header value is always replaced by the result of your user agent check. At the same time, you should also keep in mind that the user agent itself can be spoofed, too :-)

mk1024 avatar Jun 03 '24 08:06 mk1024