From 820ada639097af54d6a3e68dbd0eb62aa67fbc7d Mon Sep 17 00:00:00 2001 From: K1ngfish3r Date: Tue, 19 May 2026 20:29:44 +0500 Subject: [PATCH] place keys in correct place --- proxy.ts | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/proxy.ts b/proxy.ts index 7e9ea32dd..2d0c7277c 100644 --- a/proxy.ts +++ b/proxy.ts @@ -21,7 +21,13 @@ const settings: ServerSetting = { 'sec-fetch-dest', 'pragma', ], - disAllowResponseHeaders: ['link', 'set-cookie', 'set-cookie2'], + disAllowResponseHeaders: [ + 'link', + 'set-cookie', + 'set-cookie2', + 'content-encoding', + 'content-length', + ], useUserAgent: true, }; @@ -160,11 +166,7 @@ const proxyRequest: Connect.SimpleHandleFunction = (req, res) => { .then(async res2 => { res.statusCode = res2.status; res2.headers.forEach((val, key) => { - if ( - !settings.disAllowResponseHeaders.includes(key) && - key !== 'content-encoding' && - key !== 'content-length' - ) { + if (!settings.disAllowResponseHeaders.includes(key)) { res.setHeader(key, val); } }); @@ -234,11 +236,7 @@ proxy.on('proxyRes', function (proxyRes, req, res) { // Propagate headers but filter restricted ones Object.keys(proxyRes.headers).forEach(key => { - if ( - !settings.disAllowResponseHeaders.includes(key) && - key !== 'content-encoding' && - key !== 'content-length' - ) { + if (!settings.disAllowResponseHeaders.includes(key)) { res.setHeader(key, proxyRes.headers[key] as string); } });