From c89c536b677d5d6920f88eecc816d2a5894d9dd8 Mon Sep 17 00:00:00 2001 From: Thiago Pinto Date: Wed, 22 Apr 2026 17:47:36 +0200 Subject: [PATCH] fix: prevent tracestate/traceparent header duplication in upstream requests Add traceparent and tracestate to NOT_FORWARDED_HEADERS so they are not manually forwarded to the upstream AI gateway. OTel auto-instrumentation (UndiciInstrumentation) already injects these W3C trace-context headers from the active span context, so forwarding them manually caused each value to appear twice in the outgoing request. --- src/routes/responses/utils.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/routes/responses/utils.ts b/src/routes/responses/utils.ts index c442eb8..2b688ec 100644 --- a/src/routes/responses/utils.ts +++ b/src/routes/responses/utils.ts @@ -16,6 +16,8 @@ export const NOT_FORWARDED_HEADERS = new Set([ "te", "trailer", "trailers", + "traceparent", + "tracestate", "transfer-encoding", "upgrade", ]);