Fix proxy and split server into modules #1
|
|
@ -29,10 +29,12 @@ function proxyFetch(req: Request): Promise<Response> | 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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user