From a288351ad4b28f0ba1697a4eb8d171c51ddfd127 Mon Sep 17 00:00:00 2001 From: Asher Date: Wed, 8 Apr 2020 11:54:18 -0500 Subject: [PATCH] Respond when proxy errors Otherwise the request will just hang. --- src/node/http.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/node/http.ts b/src/node/http.ts index 07c177674..654a9d794 100644 --- a/src/node/http.ts +++ b/src/node/http.ts @@ -490,7 +490,10 @@ export class HttpServer { } else { this.server = http.createServer(this.onRequest) } - this.proxy.on("error", (error) => logger.warn(error.message)) + this.proxy.on("error", (error, _request, response) => { + response.writeHead(HttpCode.ServerError) + response.end(error.message) + }) // Intercept the response to rewrite absolute redirects against the base path. this.proxy.on("proxyRes", (response, request: ProxyRequest) => { if (response.headers.location && response.headers.location.startsWith("/") && request.base) {