fix: tap proxy survives backend errors, returns 502 with details

This commit is contained in:
admin 2026-08-08 10:31:32 +00:00
parent 348bf39517
commit 98bd0d7d23

View file

@ -39,8 +39,11 @@ class Tap(http.server.BaseHTTPRequestHandler):
self.end_headers() self.end_headers()
self.wfile.write(resp.read()) self.wfile.write(resp.read())
except Exception as e: except Exception as e:
msg += "\nERROR: " + str(e) + "\n" msg += "\nBACKEND: " + str(e) + "\n"
self.send_error(502) 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: with open(LOG, "a") as f:
f.write(msg) f.write(msg)