Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to specify response HTTP status code for Throttle middleware #571

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

vasayxtx
Copy link
Contributor

Some time ago the PR #528 was merged but seems like in some cases 503 HTTP code is more suitable. Actually, using 503 or 429 response code for rate/conn limiting is a controversial topic. As for me, 429 HTTP code should be used when a specific client is breaking a contract by making too many requests over a certain period of time. It will be a bit strange if the client receives 429 on its first request.

P.S.:

This PR provides the ability to specify the needed status code. Could you please consider it?

@pkieltyka
Copy link
Member

thanks for the PR. I'll need to find some head space to think about this

@senekis
Copy link

senekis commented Sep 30, 2022

Any news on this PR?

Agree with @vasayxtx, allowing to custom the status code (eg. 503) is better than always returning 429. It is misleading for the clients of the service, if they receive a 429 error will think are reaching their limits and that modifying the pace will make the error go away, but no, they will continue getting the errors, so is more suitable in this case 503.

@vasayxtx vasayxtx force-pushed the throttle-middleware-custom-status-code branch from 3430082 to a62d96e Compare December 27, 2023 20:25
@vasayxtx
Copy link
Contributor Author

vasayxtx commented Dec 27, 2023

I've just resolved the conflict, so the PR is ready for review/merge:)
@pkieltyka JFYI

@vasayxtx vasayxtx force-pushed the throttle-middleware-custom-status-code branch 2 times, most recently from 6b3da1b to bccb994 Compare December 28, 2023 09:00
@vasayxtx vasayxtx force-pushed the throttle-middleware-custom-status-code branch from bccb994 to c9c6c17 Compare December 28, 2023 11:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants