Merge: + http server: enable gzip compression

Close #626

* commit '3f404bc37e14bbd781f6feb62502a44188b4c7ef':
  + http server: enable gzip compression for /control/querylog
  + http server: enable gzip compression for static documents
This commit is contained in:
Simon Zolin
2019-04-16 11:11:01 +03:00
5 changed files with 28 additions and 3 deletions

4
app.go
View File

@@ -15,6 +15,7 @@ import (
"syscall"
"github.com/AdguardTeam/golibs/log"
"github.com/NYTimes/gziphandler"
"github.com/gobuffalo/packr"
)
@@ -145,8 +146,9 @@ func run(args options) {
// Initialize and run the admin Web interface
box := packr.NewBox("build/static")
// if not configured, redirect / to /install.html, otherwise redirect /install.html to /
http.Handle("/", postInstallHandler(optionalAuthHandler(http.FileServer(box))))
http.Handle("/", postInstallHandler(optionalAuthHandler(gziphandler.GzipHandler(http.FileServer(box)))))
registerControlHandlers()
// add handlers for /install paths, we only need them when we're not configured yet