diff --git a/conf/grafana.ini b/conf/grafana.ini index a39009b9ad3..f0210e89b36 100644 --- a/conf/grafana.ini +++ b/conf/grafana.ini @@ -9,6 +9,7 @@ http_addr = http_port = 3000 router_logging = false static_root_path = public +enable_gzip = false [session] ; Either "memory", "file", default is "memory" diff --git a/pkg/cmd/web.go b/pkg/cmd/web.go index 3ba64fb136c..786c5304534 100644 --- a/pkg/cmd/web.go +++ b/pkg/cmd/web.go @@ -39,6 +39,9 @@ func newMacaron() *macaron.Macaron { m := macaron.New() m.Use(middleware.Logger()) m.Use(macaron.Recovery()) + if setting.EnableGzip { + m.Use(macaron.Gziper()) + } mapStatic(m, "", "public") mapStatic(m, "app", "app") diff --git a/pkg/setting/setting.go b/pkg/setting/setting.go index 51bfb58acd6..4805949eb33 100644 --- a/pkg/setting/setting.go +++ b/pkg/setting/setting.go @@ -56,6 +56,7 @@ var ( CertFile, KeyFile string RouterLogging bool StaticRootPath string + EnableGzip bool // Http auth Anonymous bool @@ -164,6 +165,7 @@ func NewConfigContext() { StaticRootPath = Cfg.MustValue("server", "static_root_path", path.Join(WorkDir, "webapp")) RouterLogging = Cfg.MustBool("server", "router_logging", false) + EnableGzip = Cfg.MustBool("server", "enable_gzip") // Http auth Anonymous = Cfg.MustBool("auth", "anonymous", false)