Strip accept-encoding to prevent gzip in proxy chain
Toes' Bun fetch auto-decompresses responses. If Go sends gzip through our proxy, toes gets raw gzip bytes it can't handle. Stripping accept-encoding tells Go to send uncompressed. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
e197a6d3bb
commit
74155d3d0a
|
|
@ -20,13 +20,14 @@ export function createProxy(socketPath: string, isHealthy: () => boolean, isRunn
|
||||||
|
|
||||||
const hasBody = req.method !== 'GET' && req.method !== 'HEAD'
|
const hasBody = req.method !== 'GET' && req.method !== 'HEAD'
|
||||||
const body = hasBody ? await req.arrayBuffer() : undefined
|
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}`, {
|
return fetch(`http://localhost${url.pathname}${url.search}`, {
|
||||||
method: req.method,
|
method: req.method,
|
||||||
headers: req.headers,
|
headers,
|
||||||
body,
|
body,
|
||||||
unix: socketPath,
|
unix: socketPath,
|
||||||
decompress: false,
|
|
||||||
}).catch((e) => {
|
}).catch((e) => {
|
||||||
console.error('Proxy error:', e)
|
console.error('Proxy error:', e)
|
||||||
return new Response('Tronbyt server is not responding', { status: 502 })
|
return new Response('Tronbyt server is not responding', { status: 502 })
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user