diff --git a/src/resources/http.ts b/src/resources/http.ts index e890f39..eaaff63 100644 --- a/src/resources/http.ts +++ b/src/resources/http.ts @@ -80,6 +80,14 @@ const createWorker = async ( srv.on('close', () => { httpProxyStream.cancel(); }); + + httpProxyStream.on('end', () => { + if (typeof srv.close === 'function') { + srv.close(); + } else { + process.exit(1); // Close the Node.js application with a non-zero exit code + } + }); } };