From c42616006b22d50ff796cdd8fcf713ef63ce9656 Mon Sep 17 00:00:00 2001 From: webzwo0i Date: Mon, 16 Nov 2020 02:25:44 +0100 Subject: [PATCH] packages: If a client sets `Accept-Encoding: gzip`, the responseCache will include `Content-Encoding: gzip` in all future responses, even if a subsequent request does not set `Accept-Encoding` or another client requests the file without setting `Accept-Encoding`. Fix that. --- src/node/utils/caching_middleware.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/node/utils/caching_middleware.js b/src/node/utils/caching_middleware.js index eaa87660a..a31fc1bcc 100644 --- a/src/node/utils/caching_middleware.js +++ b/src/node/utils/caching_middleware.js @@ -199,6 +199,9 @@ CachingMiddleware.prototype = new function () { if (supportsGzip && (headers['content-type'] || '').match(/^application\/javascript/)) { pathStr = pathStr + '.gz'; headers['content-encoding'] = 'gzip'; + } else { + // ensure responseCache is updated + delete headers['content-encoding']; } var lastModified = (headers['last-modified']