diff --git a/server/app/api/proxy/[[...path]]/route.ts b/server/app/api/proxy/[[...path]]/route.ts index 7150582..0fcaf50 100644 --- a/server/app/api/proxy/[[...path]]/route.ts +++ b/server/app/api/proxy/[[...path]]/route.ts @@ -42,13 +42,13 @@ async function proxyRequest(req: NextRequest) { headers.set("x-forwarded-port", "443"); headers.set("x-forwarded-for", req.headers.get("x-forwarded-for") || "unknown"); + const needsBody = req.method !== "GET" && req.method !== "HEAD"; const upstreamRes = await fetch(upstream, { method: req.method, headers, - body: - req.method !== "GET" && req.method !== "HEAD" - ? (req.body as BodyInit) - : undefined, + body: needsBody ? (req.body as BodyInit) : undefined, + // Node.js fetch requires duplex when forwarding a request body stream + ...(needsBody ? { duplex: "half" } : {}), redirect: "manual", });