From a94b7526f7dcb5b171601d0d55b1e07544f30d99 Mon Sep 17 00:00:00 2001 From: EduBox Dev Date: Wed, 17 Jun 2026 18:55:50 +0000 Subject: [PATCH] fix(server/proxy): ajout duplex half pour forwarder les POST MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Route proxy: ajout de duplex: 'half' lors de l'envoi d'un body, requis par Node.js fetch pour éviter l'erreur 500 sur wp-login.php --- server/app/api/proxy/[[...path]]/route.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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", });