compress
This commit is contained in:
		
							parent
							
								
									16920caf9c
								
							
						
					
					
						commit
						8e0949c66f
					
				
					 2 changed files with 8 additions and 0 deletions
				
			
		| 
						 | 
					@ -54,6 +54,7 @@
 | 
				
			||||||
		"@types/js-yaml": "3.11.1",
 | 
							"@types/js-yaml": "3.11.1",
 | 
				
			||||||
		"@types/koa": "2.0.45",
 | 
							"@types/koa": "2.0.45",
 | 
				
			||||||
		"@types/koa-bodyparser": "4.2.0",
 | 
							"@types/koa-bodyparser": "4.2.0",
 | 
				
			||||||
 | 
							"@types/koa-compress": "^2.0.8",
 | 
				
			||||||
		"@types/koa-favicon": "2.0.19",
 | 
							"@types/koa-favicon": "2.0.19",
 | 
				
			||||||
		"@types/koa-mount": "3.0.1",
 | 
							"@types/koa-mount": "3.0.1",
 | 
				
			||||||
		"@types/koa-multer": "1.0.0",
 | 
							"@types/koa-multer": "1.0.0",
 | 
				
			||||||
| 
						 | 
					@ -137,6 +138,7 @@
 | 
				
			||||||
		"jsdom": "11.7.0",
 | 
							"jsdom": "11.7.0",
 | 
				
			||||||
		"koa": "2.5.0",
 | 
							"koa": "2.5.0",
 | 
				
			||||||
		"koa-bodyparser": "4.2.0",
 | 
							"koa-bodyparser": "4.2.0",
 | 
				
			||||||
 | 
							"koa-compress": "^2.0.0",
 | 
				
			||||||
		"koa-favicon": "2.0.1",
 | 
							"koa-favicon": "2.0.1",
 | 
				
			||||||
		"koa-mount": "3.0.0",
 | 
							"koa-mount": "3.0.0",
 | 
				
			||||||
		"koa-multer": "1.0.2",
 | 
							"koa-multer": "1.0.2",
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -5,9 +5,11 @@
 | 
				
			||||||
import * as fs from 'fs';
 | 
					import * as fs from 'fs';
 | 
				
			||||||
import * as http from 'http';
 | 
					import * as http from 'http';
 | 
				
			||||||
import * as http2 from 'http2';
 | 
					import * as http2 from 'http2';
 | 
				
			||||||
 | 
					import * as zlib from 'zlib';
 | 
				
			||||||
import * as Koa from 'koa';
 | 
					import * as Koa from 'koa';
 | 
				
			||||||
import * as Router from 'koa-router';
 | 
					import * as Router from 'koa-router';
 | 
				
			||||||
import * as mount from 'koa-mount';
 | 
					import * as mount from 'koa-mount';
 | 
				
			||||||
 | 
					import * as compress from 'koa-compress';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import activityPub from './activitypub';
 | 
					import activityPub from './activitypub';
 | 
				
			||||||
import webFinger from './webfinger';
 | 
					import webFinger from './webfinger';
 | 
				
			||||||
| 
						 | 
					@ -17,6 +19,10 @@ import config from '../config';
 | 
				
			||||||
const app = new Koa();
 | 
					const app = new Koa();
 | 
				
			||||||
app.proxy = true;
 | 
					app.proxy = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					app.use(compress({
 | 
				
			||||||
 | 
						flush: zlib.constants.Z_SYNC_FLUSH
 | 
				
			||||||
 | 
					}));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// HSTS
 | 
					// HSTS
 | 
				
			||||||
// 6months (15552000sec)
 | 
					// 6months (15552000sec)
 | 
				
			||||||
if (config.url.startsWith('https')) {
 | 
					if (config.url.startsWith('https')) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue