Strip accept-encoding to avoid ZlibError in proxy chain

The Go server returns gzip responses, but when Bun proxies these
through to the toes proxy, the double-proxy causes a ZlibError
during decompression. Stripping accept-encoding tells the Go
server to send uncompressed responses.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Corey Johnson 2026-03-10 17:36:24 -07:00
parent be6719733b
commit 3fe4116ec7

View File

@ -30,10 +30,12 @@ function proxyFetch(req: Request): Promise<Response> | Response {
}
const hasBody = req.method !== 'GET' && req.method !== 'HEAD'
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: hasBody ? req.body : undefined,
unix: SOCKET_PATH,
}).catch((e) => {