asgi-proxy-lib icon indicating copy to clipboard operation
asgi-proxy-lib copied to clipboard

Intercepted errors should be returned as HTTP errors to the client

Open simonw opened this issue 11 months ago • 3 comments

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.

simonw avatar Jul 16 '23 15:07 simonw