diff --git a/src/server.ts b/src/server.ts index d658ec8..9cbb65d 100644 --- a/src/server.ts +++ b/src/server.ts @@ -29,10 +29,12 @@ function proxyFetch(req: Request): Promise | Response { .catch(() => new Response('unhealthy', { status: 503 })) } + const hasBody = req.method !== 'GET' && req.method !== 'HEAD' + return fetch(`http://localhost${url.pathname}${url.search}`, { method: req.method, headers: req.headers, - body: req.body, + body: hasBody ? req.body : undefined, unix: SOCKET_PATH, }).catch((e) => { console.error('Proxy error:', e)