Enable gzip compression

This commit is contained in:
Iwasaki Yudai 2017-08-22 17:31:27 +09:00
parent 024ab8f28e
commit 48c91151ad
10 changed files with 634 additions and 1 deletions

View file

@ -14,6 +14,7 @@ import (
noesctmpl "text/template"
"time"
"github.com/NYTimes/gziphandler"
"github.com/elazarl/go-bindata-assetfs"
"github.com/gorilla/websocket"
"github.com/pkg/errors"
@ -197,7 +198,8 @@ func (server *Server) setupHandlers(ctx context.Context, cancel context.CancelFu
siteHandler = server.wrapBasicAuth(siteHandler, server.options.Credential)
}
siteHandler = server.wrapLogger(server.wrapHeaders(siteHandler))
withGz := gziphandler.GzipHandler(server.wrapHeaders(siteHandler))
siteHandler = server.wrapLogger(withGz)
wsMux := http.NewServeMux()
wsMux.Handle("/", siteHandler)