Skip to content

Commit a288351

Browse files
committed
Respond when proxy errors
Otherwise the request will just hang.
1 parent 363cdd0 commit a288351

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/node/http.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,10 @@ export class HttpServer {
490490
} else {
491491
this.server = http.createServer(this.onRequest)
492492
}
493-
this.proxy.on("error", (error) => logger.warn(error.message))
493+
this.proxy.on("error", (error, _request, response) => {
494+
response.writeHead(HttpCode.ServerError)
495+
response.end(error.message)
496+
})
494497
// Intercept the response to rewrite absolute redirects against the base path.
495498
this.proxy.on("proxyRes", (response, request: ProxyRequest) => {
496499
if (response.headers.location && response.headers.location.startsWith("/") && request.base) {

0 commit comments

Comments
 (0)