Adam Borygo
Adam Borygo2d ago

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"
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?
1 Reply
Adam Borygo
Adam BorygoOP22h ago
explained more here + reproduction: https://github.com/trpc/trpc/issues/6909
GitHub
bug: tRPC sends duplicate header Transfer-Encoding: chunked · Issu...
Provide environment information System: OS: macOS 15.4.1 CPU: (10) arm64 Apple M2 Pro Memory: 133.44 MB / 16.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 22.14.0 - ~/.nvm/versions/node/v22.14.0/bin/...

Did you find this page helpful?