fix(evobgp): update header handling in evobgpProxyRoutes to preserve content-encoding
Publish Docker image / build-and-push (push) Successful in 1m45s
Publish Docker image / build-and-push (push) Successful in 1m45s
- 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
This commit is contained in:
@@ -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]);
|
||||
|
||||
Reference in New Issue
Block a user