go-chi / httprate

net/http rate limiter middleware
MIT License
270 stars 18 forks source link

Set the Retry-After header, per RFC 6585, when returning a 429 #3

Closed timbunce closed 3 years ago

timbunce commented 3 years ago

This allows services using httprate to work with http clients that expect the standard Retry-After header described in RFC 6585, such as hashicorp/go-retryablehttp's DefaultBackoff and curl 7.66+.

Retry-After is always set to l.windowLength, rather than the seconds remaining till the end of the current window, to reduce the likelihood of creating thundering hurds at window intervals. I don't have a strong opinion about that and would be happy to change it.

yaronius commented 3 years ago

Hi @pkieltyka! Do you have any feedback on this?

yaronius commented 3 years ago

Any feedback on this, please? What needs to be done to merge this?

pkieltyka commented 3 years ago

thank you @timbunce for the PR and @yaronius for the remidner