+ http server: enable gzip compression for static documents

This commit is contained in:
Simon Zolin
2019-04-04 15:32:00 +03:00
parent b453d9f41d
commit cca61a33c6
3 changed files with 11 additions and 2 deletions

4
app.go
View File

@@ -14,6 +14,7 @@ import (
"syscall"
"github.com/AdguardTeam/golibs/log"
"github.com/NYTimes/gziphandler"
"github.com/gobuffalo/packr"
)
@@ -133,8 +134,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