From a2d05b0cf057cedd93bde112a3f2ee082900274f Mon Sep 17 00:00:00 2001 From: Sander Declerck Date: Tue, 14 Oct 2025 14:18:33 +0200 Subject: [PATCH] More logs --- packages/safe-chain/src/registryProxy/plainHttpProxy.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/safe-chain/src/registryProxy/plainHttpProxy.js b/packages/safe-chain/src/registryProxy/plainHttpProxy.js index 68a2362..507f518 100644 --- a/packages/safe-chain/src/registryProxy/plainHttpProxy.js +++ b/packages/safe-chain/src/registryProxy/plainHttpProxy.js @@ -1,8 +1,10 @@ import * as http from "http"; import * as https from "https"; +// oxlint-disable no-console - just for testing, remove afterwards export function handleHttpProxyRequest(req, res) { const url = new URL(req.url); + console.log(`Proxying request to: ${req.url}`); let protocol; if (url.protocol === "http:") { @@ -23,7 +25,8 @@ export function handleHttpProxyRequest(req, res) { res.writeHead(proxyRes.statusCode, proxyRes.headers); proxyRes.pipe(res); - proxyRes.on("error", () => { + proxyRes.on("error", (err) => { + console.log("Error in proxy response stream:", err); // Stream error while piping response // Response headers already sent, can't send error status }); @@ -35,18 +38,21 @@ export function handleHttpProxyRequest(req, res) { }); req.on("error", () => { + console.log("Error in client request stream"); // Client request stream error // Abort the proxy request proxyRequest.destroy(); }); res.on("error", () => { + console.log("Error in client response stream"); // Client response stream error (client disconnected) // Clean up proxy streams proxyRequest.destroy(); }); res.on("close", () => { + console.log("Client response stream closed"); // Client disconnected // Abort the proxy request to avoid unnecessary work if (!res.writableEnded) {