From fd49e063f6104155b2a84607ba07b71cda0b1e03 Mon Sep 17 00:00:00 2001 From: Ben Allfree Date: Wed, 3 Jan 2024 09:32:11 -0800 Subject: [PATCH] Log proxy default requests --- src/cli/proxy/server.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/cli/proxy/server.ts b/src/cli/proxy/server.ts index 2d898352..3835984a 100644 --- a/src/cli/proxy/server.ts +++ b/src/cli/proxy/server.ts @@ -47,7 +47,14 @@ forEach(hostnameRoutes, (target, host) => { const handler = createProxyMiddleware({ target: `http://localhost:${DAEMON_PORT()}`, }) -app.all(`*`, handler) +app.all(`*`, (req, res, next) => { + const method = req.method + const fullUrl = req.protocol + '://' + req.get('host') + req.originalUrl + + console.log(`${method} ${fullUrl} -> ${`http://localhost:${DAEMON_PORT()}`}`) + + handler(req, res, next) +}) if (IS_DEV()) { http.createServer(app).listen(80, () => {