ntfy icon indicating copy to clipboard operation
ntfy copied to clipboard

Return rate limits when limited

Open ThisIsMissEm opened this issue 1 year ago • 1 comments

:bulb: Idea

Currently when ntfy rate limits a client, it seems to just send the 429 status code back, but doesn't advise as to when the rate limit would be lifted. This means that clients can't dynamically pause sending notifications until the rate limit resets, which leads to IP bans.

There is a standards track IETF proposal for RateLimit headers, which could make sense to use: https://www.ietf.org/archive/id/draft-ietf-httpapi-ratelimit-headers-07.html

This currently affects Mastodon: https://github.com/mastodon/mastodon/issues/26078

By advertising when the rate limits reset, we could delay all other notification until after the rate limit resets. I tried to look at both the documentation and code to see if you currently have any code that advertises to the client information about the rate limit, and couldn't find any.

:computer: Target components

  • ntfy server

ThisIsMissEm avatar Aug 27 '24 22:08 ThisIsMissEm

You could also use the Retry-After header: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After

ThisIsMissEm avatar Oct 17 '24 17:10 ThisIsMissEm