Adam BorygoA
tRPC4mo ago
Adam Borygo

tRPC sends duplicate header

i tried setting up a reverse proxy for my NextJS + tRPC app using those 3 options:
  • nginx
  • traefik
  • caddy
in all of them when i try to invoke a procedure using a .useMutation() hook it fails with such error:

nginx: upstream sent duplicate header line: "Transfer-Encoding: chunked"
traefik, caddy: net/http: HTTP/1.x transport connection broken: too many transfer encodings: [\"chunked\" \"chunked\"]

after investigating a bit in nginx i can see that it indeed sends it twice:

reverse-proxy-1  | 2025/08/23 19:59:07 [debug] 30#30: *5 http proxy status 200 "200 OK"
reverse-proxy-1  | 2025/08/23 19:59:07 [debug] 30#30: *5 http proxy header: "Vary: rsc, next-router-state-tree, next-router-prefetch, next-router-segment-prefetch, trpc-accept, Accept-Encoding"
reverse-proxy-1  | 2025/08/23 19:59:07 [debug] 30#30: *5 http proxy header: "Content-Type: application/json"
reverse-proxy-1  | 2025/08/23 19:59:07 [debug] 30#30: *5 http proxy header: "Transfer-Encoding: chunked"
reverse-proxy-1  | 2025/08/23 19:59:07 [debug] 30#30: *5 http proxy header: "Content-Encoding: gzip"
reverse-proxy-1  | 2025/08/23 19:59:07 [debug] 30#30: *5 http proxy header: "Date: Sat, 23 Aug 2025 19:59:06 GMT"
reverse-proxy-1  | 2025/08/23 19:59:07 [debug] 30#30: *5 http proxy header: "Transfer-Encoding: chunked"


what can i do to fix this? is this an issue on my end somehow?
Was this page helpful?