From 345aacf746f3e839b036cd6d0daf446fe9dbfe4f Mon Sep 17 00:00:00 2001 From: Ihor Burlachenko Date: Fri, 7 Jun 2024 13:12:32 +0200 Subject: [PATCH] Added logging to the WebSocket proxy in the API application --- server/src/api.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/server/src/api.ts b/server/src/api.ts index a857e5b..0cc3fe7 100644 --- a/server/src/api.ts +++ b/server/src/api.ts @@ -43,13 +43,27 @@ async function main() { target: config.csprCloudStreamingUrl, ws: true, changeOrigin: true, + logLevel: 'debug', headers: { authorization: config.csprCloudAccessKey, }, on: { proxyReqWs: (proxyReq) => { + console.log('WebSocket connection requestWS', res); proxyReq.removeHeader('Origin'); }, + proxyReq: (proxyReq, req, res) => { + console.log('WebSocket connection request', req.url) + }, + open: (proxySocket) => { + console.log('WebSocket connection opened'); + }, + close: (res, socket, head) => { + console.log('WebSocket connection closed', res); + }, + onError(err, req, res, target) { + console.log('WebSocket connection error', err); + } } }); app.get('/deploys', csprCloudStreamingProxy);