fix: tap proxy survives backend errors, returns 502 with details
This commit is contained in:
parent
348bf39517
commit
98bd0d7d23
1 changed files with 5 additions and 2 deletions
|
|
@ -39,8 +39,11 @@ class Tap(http.server.BaseHTTPRequestHandler):
|
|||
self.end_headers()
|
||||
self.wfile.write(resp.read())
|
||||
except Exception as e:
|
||||
msg += "\nERROR: " + str(e) + "\n"
|
||||
self.send_error(502)
|
||||
msg += "\nBACKEND: " + str(e) + "\n"
|
||||
self.send_response(502)
|
||||
self.send_header('Content-Type', 'text/plain')
|
||||
self.end_headers()
|
||||
self.wfile.write(b"Backend unreachable: " + str(e).encode())
|
||||
|
||||
with open(LOG, "a") as f:
|
||||
f.write(msg)
|
||||
|
|
|
|||
Loading…
Reference in a new issue