diff --git a/src/express-http-server.js b/src/express-http-server.js index 223811d2..bf549d51 100644 --- a/src/express-http-server.js +++ b/src/express-http-server.js @@ -38,6 +38,16 @@ class ExpressHTTPServer { app.use(require('compression')()); } + if (this.cache && this.gzip) { + app.use(function(req, res, next) { + if (res.body) { + res.send(res.body); + } else { + next(); + } + }); + } + if (username !== undefined || password !== undefined) { this.ui.writeLine(`adding basic auth; username=${username}; password=${password}`); app.use(basicAuth(username, password)); diff --git a/src/worker.js b/src/worker.js index 72f83151..befc2bbf 100644 --- a/src/worker.js +++ b/src/worker.js @@ -37,6 +37,7 @@ class Worker { } if (!this.httpServer.cache) { this.httpServer.cache = this.cache; } + if (!this.httpServer.gzip) { this.httpServer.gzip = this.gzip; } if (!this.httpServer.distPath) { this.httpServer.distPath = this.distPath; } if (!this.httpServer.ui) { this.httpServer.ui = this.ui; } }