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';
5
5
import Router from '@koa/router' ;
6
6
import ssrMiddleware from './server/ssrMiddleware' ;
7
7
import rateLimitMiddleware from './server/rateLimitMiddleware' ;
8
+ import compress from 'koa-compress' ;
9
+ import { constants } from 'zlib' ;
8
10
9
11
console . log ( process . env . REACT_APP_SSR ) ;
10
12
@@ -13,6 +15,22 @@ const router = new Router();
13
15
14
16
app . proxy = true ;
15
17
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
+
16
34
app . use (
17
35
serve ( path . resolve ( './build' ) , {
18
36
index : false ,
You can’t perform that action at this time.
0 commit comments