Gracefully reject mulitpart requests when proxying it to another server #2685
Unanswered
roma-glushko
asked this question in
Potential Issue
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hey everyone 👋
I'm proxing requests that comes to my Starlette API server to another downstream service via HTTPX like that:
When it comes to the multipart requests that upload files, it's possible that server can reject those requests if the attached file sizes are bigger then the allowed threshold. When that happens the downstream service responds with some 4XX error that was supposed to be returned back to the initial caller.
However it doesn't happen that way. Instead, HTTPX fails with the WriteError leaving it hard to distinguish whether the downstream service was unavailable or the file size was to big that that 4XX response get missed:
Is there a way to gracefully reject such a request without swallowing the response of the downstream service?
Any ideas are appreciated 🙏
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions