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:
parent
be6719733b
commit
3fe4116ec7
|
|
@ -30,10 +30,12 @@ function proxyFetch(req: Request): Promise<Response> | Response {
|
||||||
}
|
}
|
||||||
|
|
||||||
const hasBody = req.method !== 'GET' && req.method !== 'HEAD'
|
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}`, {
|
return fetch(`http://localhost${url.pathname}${url.search}`, {
|
||||||
method: req.method,
|
method: req.method,
|
||||||
headers: req.headers,
|
headers,
|
||||||
body: hasBody ? req.body : undefined,
|
body: hasBody ? req.body : undefined,
|
||||||
unix: SOCKET_PATH,
|
unix: SOCKET_PATH,
|
||||||
}).catch((e) => {
|
}).catch((e) => {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user