asgi-proxy-lib
asgi-proxy-lib copied to clipboard
Intercepted errors should be returned as HTTP errors to the client
This code here: https://github.com/simonw/asgi-proxy-lib/blob/0730e872d5472db018f80a5c5b97aa80f03711ea/asgi_proxy/init.py#L75-L79
It should actually return a 500 error with a simple HTML page saying roughly what went wrong.
There are actually a few relevant HTTP errors here:
-
502 Bad Gateway
- if it gets a "bad response" of some sort from the backend (not sure what the definition of "bad" there should be). -
504 Gateway Timeout
- if the backend times out. Having a timeout setting would be useful generally. -
503 Service Unavailable
- backend server is unavailable.
I'm not sure how to decide between a 502 and a 503.