From 16e5bd7a742d4c0c87507c793b93d743a0758874 Mon Sep 17 00:00:00 2001 From: Stephan Lagerwaard Date: Tue, 21 Jan 2025 16:20:15 +0100 Subject: [PATCH] Add auth headers to proxy traces endpoint --- api/src/routes/traces.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/api/src/routes/traces.ts b/api/src/routes/traces.ts index 6166a1ba6..5326ee545 100644 --- a/api/src/routes/traces.ts +++ b/api/src/routes/traces.ts @@ -27,7 +27,11 @@ app.get("/v1/traces", async (ctx) => { const fpxWorker = await getSetting(db, "fpxWorkerProxy"); if (fpxWorker?.enabled && fpxWorker.baseUrl) { - const response = await fetch(`${fpxWorker.baseUrl}/v1/traces`); + const headers: Record = fpxWorker.bearerToken + ? { Authorization: `Bearer ${fpxWorker.bearerToken}` } + : {}; + + const response = await fetch(`${fpxWorker.baseUrl}/v1/traces`, { headers }); const json = await response.json(); return ctx.json(json as JSON); }