Fix proxy and split server into modules #1
|
|
@ -20,13 +20,14 @@ export function createProxy(socketPath: string, isHealthy: () => boolean, isRunn
|
|||
|
||||
const hasBody = req.method !== 'GET' && req.method !== 'HEAD'
|
||||
const body = hasBody ? await req.arrayBuffer() : undefined
|
||||
const headers = new Headers(req.headers)
|
||||
headers.delete('accept-encoding')
|
||||
|
||||
return fetch(`http://localhost${url.pathname}${url.search}`, {
|
||||
method: req.method,
|
||||
headers: req.headers,
|
||||
headers,
|
||||
body,
|
||||
unix: socketPath,
|
||||
decompress: false,
|
||||
}).catch((e) => {
|
||||
console.error('Proxy error:', e)
|
||||
return new Response('Tronbyt server is not responding', { status: 502 })
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user