From 5c9a83be7cfaf859dfa29186b7e0781a8d561d88 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Thu, 10 Feb 2022 11:01:56 -0500 Subject: [PATCH] Stop doing Gzip in the middleware (#25227) --- middleware/index.js | 2 - package-lock.json | 92 --------------------------------------- package.json | 1 - tests/rendering/server.js | 6 --- 4 files changed, 101 deletions(-) diff --git a/middleware/index.js b/middleware/index.js index 82e9c200b046..691fedd7c3e6 100644 --- a/middleware/index.js +++ b/middleware/index.js @@ -15,7 +15,6 @@ import csp from './csp.js' import cookieParser from './cookie-parser.js' import csrf from './csrf.js' import handleCsrfErrors from './handle-csrf-errors.js' -import compression from 'compression' import { setDefaultFastlySurrogateKey } from './set-fastly-surrogate-key.js' import setFastlyCacheHeaders from './set-fastly-cache-headers.js' import catchBadAcceptLanguage from './catch-bad-accept-language.js' @@ -208,7 +207,6 @@ export default function (app) { // *** Headers *** app.set('etag', false) // We will manage our own ETags if desired - app.use(compression()) app.use(catchBadAcceptLanguage) // *** Config and context for redirects *** diff --git a/package-lock.json b/package-lock.json index 979de9c3bc89..ccbb53ae7f03 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,7 +19,6 @@ "ajv-formats": "^2.1.1", "cheerio": "^1.0.0-rc.10", "classnames": "^2.3.1", - "compression": "^1.7.4", "connect-datadog": "0.0.9", "connect-slashes": "^1.4.0", "cookie-parser": "^1.4.6", @@ -6387,14 +6386,6 @@ "resolved": "https://registry.npmjs.org/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz", "integrity": "sha1-hZgoeOIbmOHGZCXgPQF0eI9Wnug=" }, - "node_modules/bytes": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", - "integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg=", - "engines": { - "node": ">= 0.8" - } - }, "node_modules/cacheable-lookup": { "version": "5.0.4", "resolved": "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-5.0.4.tgz", @@ -6994,47 +6985,6 @@ "integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==", "dev": true }, - "node_modules/compressible": { - "version": "2.0.18", - "resolved": "https://registry.npmjs.org/compressible/-/compressible-2.0.18.tgz", - "integrity": "sha512-AF3r7P5dWxL8MxyITRMlORQNaOA2IkAFaTr4k7BUumjPtRpGDTZpl0Pb1XCO6JeDCBdp126Cgs9sMxqSjgYyRg==", - "dependencies": { - "mime-db": ">= 1.43.0 < 2" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/compression": { - "version": "1.7.4", - "resolved": "https://registry.npmjs.org/compression/-/compression-1.7.4.tgz", - "integrity": "sha512-jaSIDzP9pZVS4ZfQ+TzvtiWhdpFhE2RDHz8QJkpX9SIpLq88VueF5jJw6t+6CUQcAoA6t+x89MLrWAqpfDE8iQ==", - "dependencies": { - "accepts": "~1.3.5", - "bytes": "3.0.0", - "compressible": "~2.0.16", - "debug": "2.6.9", - "on-headers": "~1.0.2", - "safe-buffer": "5.1.2", - "vary": "~1.1.2" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/compression/node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/compression/node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" - }, "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -27545,11 +27495,6 @@ "resolved": "https://registry.npmjs.org/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz", "integrity": "sha1-hZgoeOIbmOHGZCXgPQF0eI9Wnug=" }, - "bytes": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", - "integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg=" - }, "cacheable-lookup": { "version": "5.0.4", "resolved": "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-5.0.4.tgz", @@ -28002,43 +27947,6 @@ "integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==", "dev": true }, - "compressible": { - "version": "2.0.18", - "resolved": "https://registry.npmjs.org/compressible/-/compressible-2.0.18.tgz", - "integrity": "sha512-AF3r7P5dWxL8MxyITRMlORQNaOA2IkAFaTr4k7BUumjPtRpGDTZpl0Pb1XCO6JeDCBdp126Cgs9sMxqSjgYyRg==", - "requires": { - "mime-db": ">= 1.43.0 < 2" - } - }, - "compression": { - "version": "1.7.4", - "resolved": "https://registry.npmjs.org/compression/-/compression-1.7.4.tgz", - "integrity": "sha512-jaSIDzP9pZVS4ZfQ+TzvtiWhdpFhE2RDHz8QJkpX9SIpLq88VueF5jJw6t+6CUQcAoA6t+x89MLrWAqpfDE8iQ==", - "requires": { - "accepts": "~1.3.5", - "bytes": "3.0.0", - "compressible": "~2.0.16", - "debug": "2.6.9", - "on-headers": "~1.0.2", - "safe-buffer": "5.1.2", - "vary": "~1.1.2" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "requires": { - "ms": "2.0.0" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" - } - } - }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", diff --git a/package.json b/package.json index 76b8d417d60a..dbd46ec6b274 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,6 @@ "ajv-formats": "^2.1.1", "cheerio": "^1.0.0-rc.10", "classnames": "^2.3.1", - "compression": "^1.7.4", "connect-datadog": "0.0.9", "connect-slashes": "^1.4.0", "cookie-parser": "^1.4.6", diff --git a/tests/rendering/server.js b/tests/rendering/server.js index c47dd24d14fa..2c35f0840d2c 100644 --- a/tests/rendering/server.js +++ b/tests/rendering/server.js @@ -103,12 +103,6 @@ describe('server', () => { }) }) - test('uses gzip compression', async () => { - const res = await get('/en') - expect(res.headers['content-encoding']).toBe('gzip') - expect(res.headers['transfer-encoding']).toBe('chunked') - }) - test('sets Content Security Policy (CSP) headers', async () => { const res = await get('/en') expect('content-security-policy' in res.headers).toBe(true)