Add support for brotli compression (#8169)

* chore(package): upgrade koa-compress

Signed-off-by: tanmoyopenroot <tanmoy.openroot@gmail.com>

* fix(middleware): add config option

Signed-off-by: tanmoyopenroot <tanmoy.openroot@gmail.com>

* chore(docs): update gzip docs

Signed-off-by: tanmoyopenroot <tanmoy.openroot@gmail.com>
This commit is contained in:
Tanmoy Bhowmik 2020-10-07 13:19:18 +05:30 committed by GitHub
parent 9a2886036d
commit 983c61c144
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 18 additions and 9 deletions

View File

@ -182,6 +182,7 @@ The session doesn't work with `mongo` as a client. The package that we should us
- [`gzip`](https://en.wikipedia.org/wiki/Gzip)
- `enabled` (boolean): Enable or not GZIP response compression.
- `options` (Object): Allow passing of options from [koa-compress](https://github.com/koajs/compress#options).
- `responseTime`
- `enabled` (boolean): Enable or not `X-Response-Time header` to response. Default value: `false`.
- `poweredBy`

View File

@ -1,5 +1,6 @@
{
"gzip": {
"enabled": false
"enabled": false,
"options": {}
}
}

View File

@ -12,7 +12,8 @@ module.exports = strapi => {
*/
initialize() {
strapi.app.use(compress());
const { options = {} } = strapi.config.middleware.settings.gzip;
strapi.app.use(compress(options));
},
};
};

View File

@ -32,7 +32,7 @@
"koa": "^2.8.0",
"koa-body": "^4.2.0",
"koa-compose": "^4.1.0",
"koa-compress": "^3.0.0",
"koa-compress": "^5.0.1",
"koa-convert": "^1.2.0",
"koa-favicon": "^2.0.0",
"koa-i18n": "^2.1.0",

View File

@ -11419,15 +11419,16 @@ koa-compose@~2.3.0:
resolved "https://registry.yarnpkg.com/koa-compose/-/koa-compose-2.3.0.tgz#4617fa832a16412a56967334304efd797d6ed35c"
integrity sha1-Rhf6gyoWQSpWlnM0ME79eX1u01w=
koa-compress@^3.0.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/koa-compress/-/koa-compress-3.1.0.tgz#00fb0af695dc4661c6de261a18da669626ea3ca1"
integrity sha512-0m24/yS/GbhWI+g9FqtvStY+yJwTObwoxOvPok6itVjRen7PBWkjsJ8pre76m+99YybXLKhOJ62mJ268qyBFMQ==
koa-compress@^5.0.1:
version "5.0.1"
resolved "https://registry.yarnpkg.com/koa-compress/-/koa-compress-5.0.1.tgz#9e89e2847998f8f9f73a5674e5739a2f4b6531fc"
integrity sha512-uTo7Hcyyt6e9o2X3htRS/SNEKy9vDOUc/r1qs/F0YI2Frv9IEbkjz/9dC6IdJWBQAG34lRuU7jBXeq3DRur9Ng==
dependencies:
bytes "^3.0.0"
compressible "^2.0.0"
http-errors "^1.7.3"
koa-is-json "^1.0.0"
statuses "^1.0.0"
statuses "^2.0.0"
koa-convert@^1.2.0:
version "1.2.0"
@ -17786,11 +17787,16 @@ static-extend@^0.1.1:
define-property "^0.2.5"
object-copy "^0.1.0"
"statuses@>= 1.4.0 < 2", "statuses@>= 1.5.0 < 2", statuses@^1.0.0, statuses@^1.5.0, statuses@~1.5.0:
"statuses@>= 1.4.0 < 2", "statuses@>= 1.5.0 < 2", statuses@^1.5.0, statuses@~1.5.0:
version "1.5.0"
resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c"
integrity sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=
statuses@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/statuses/-/statuses-2.0.0.tgz#aa7b107e018eb33e08e8aee2e7337e762dda1028"
integrity sha512-w9jNUUQdpuVoYqXxnyOakhckBbOxRaoYqJscyIBYCS5ixyCnO7nQn7zBZvP9zf5QOPZcz2DLUpE3KsNPbJBOFA==
std-env@^2.2.1:
version "2.2.1"
resolved "https://registry.yarnpkg.com/std-env/-/std-env-2.2.1.tgz#2ffa0fdc9e2263e0004c1211966e960948a40f6b"