File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,8 @@ import proxy from 'koa-better-http-proxy';
55import Router from '@koa/router' ;
66import ssrMiddleware from './server/ssrMiddleware' ;
77import rateLimitMiddleware from './server/rateLimitMiddleware' ;
8+ import compress from 'koa-compress' ;
9+ import { constants } from 'zlib' ;
810
911console . log ( process . env . REACT_APP_SSR ) ;
1012
@@ -13,6 +15,22 @@ const router = new Router();
1315
1416app . proxy = true ;
1517
18+ app . use (
19+ compress ( {
20+ filter ( contentType ) {
21+ return / t e x t / i. test ( contentType ) ;
22+ } ,
23+ threshold : 2048 ,
24+ gzip : {
25+ flush : constants . Z_SYNC_FLUSH ,
26+ } ,
27+ deflate : {
28+ flush : constants . Z_SYNC_FLUSH ,
29+ } ,
30+ br : false , // disable brotli
31+ } ) ,
32+ ) ;
33+
1634app . use (
1735 serve ( path . resolve ( './build' ) , {
1836 index : false ,
You can’t perform that action at this time.
0 commit comments