fix: strip content-encoding header in proxyToGo to prevent Brotli decode error

Node fetch auto-decompresses upstream responses, but proxy_go.js was
forwarding the original content-encoding header (e.g. br/gzip) to clients.
Clients then tried to decompress already-decompressed data and failed.
Filter out content-encoding alongside content-length.
This commit is contained in:
MuziIsabel
2026-04-25 12:10:28 +08:00
parent e4a4b0ac0b
commit de9d128545

View File

@@ -53,7 +53,8 @@ async function proxyToGo(req, res, rawBody) {
res.statusCode = upstream.status;
upstream.headers.forEach((value, key) => {
if (key.toLowerCase() === 'content-length') {
const lower = key.toLowerCase();
if (lower === 'content-length' || lower === 'content-encoding') {
return;
}
res.setHeader(key, value);