mirror of
https://github.com/CJackHwang/ds2api.git
synced 2026-05-04 16:35:27 +08:00
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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user