From e99700a9163afe8e32a87de5b0cc6a41a706484d Mon Sep 17 00:00:00 2001 From: shats Date: Wed, 8 Apr 2026 00:13:10 +0700 Subject: [PATCH] fix(evobgp): update header handling in evobgpProxyRoutes to preserve content-encoding - Modified header processing to retain content-encoding, ensuring proper handling of gzip responses from upstream servers. - Added comments for clarity on the importance of this change to avoid issues with client response interpretation. Made-with: Cursor --- backend/routes/evobgpProxyRoutes.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/backend/routes/evobgpProxyRoutes.js b/backend/routes/evobgpProxyRoutes.js index dc56e40..4ca1cb9 100644 --- a/backend/routes/evobgpProxyRoutes.js +++ b/backend/routes/evobgpProxyRoutes.js @@ -79,7 +79,9 @@ function createEvobgpProxy({ logger = console } = {}) { const clientReq = lib.request(opts, (clientRes) => { res.status(clientRes.statusCode); - const skip = new Set(['connection', 'transfer-encoding', 'content-encoding']); + // Не отбрасываем content-encoding: иначе upstream может отдать gzip-тело, + // а клиент не узнает, что его нужно распаковать (в браузере будет «мусор»). + const skip = new Set(['connection', 'transfer-encoding']); Object.keys(clientRes.headers).forEach((k) => { if (!skip.has(k.toLowerCase())) { res.setHeader(k, clientRes.headers[k]);