diff options
author | =Corey Hulen <corey@hulen.com> | 2016-03-17 09:51:45 -0700 |
---|---|---|
committer | =Corey Hulen <corey@hulen.com> | 2016-03-17 09:51:45 -0700 |
commit | 5273559ca101d8ae4a55104f18081ab011e5068c (patch) | |
tree | f152b638101b224ffc59ed000e384b651915266a /web/web.go | |
parent | 074f15f761ff50388b58e35e8354c139c06a807e (diff) | |
parent | 128204b47a9ff89bf2bea97cd21d3b8892151e69 (diff) | |
download | chat-5273559ca101d8ae4a55104f18081ab011e5068c.tar.gz chat-5273559ca101d8ae4a55104f18081ab011e5068c.tar.bz2 chat-5273559ca101d8ae4a55104f18081ab011e5068c.zip |
Fixing merge
Diffstat (limited to 'web/web.go')
-rw-r--r-- | web/web.go | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/web/web.go b/web/web.go index 86b642f3b..ff5040a4b 100644 --- a/web/web.go +++ b/web/web.go @@ -7,6 +7,8 @@ import ( "net/http" "strings" + "github.com/NYTimes/gziphandler" + l4g "github.com/alecthomas/log4go" "github.com/mattermost/platform/api" "github.com/mattermost/platform/model" @@ -23,11 +25,17 @@ func InitWeb() { mainrouter := api.Srv.Router - staticDir := utils.FindDir(CLIENT_DIR) - l4g.Debug("Using client directory at %v", staticDir) - mainrouter.PathPrefix("/static/").Handler(http.StripPrefix("/static/", http.FileServer(http.Dir(staticDir)))) + if *utils.Cfg.ServiceSettings.WebserverMode != "disabled" { + staticDir := utils.FindDir(CLIENT_DIR) + l4g.Debug("Using client directory at %v", staticDir) + if *utils.Cfg.ServiceSettings.WebserverMode == "gzip" { + mainrouter.PathPrefix("/static/").Handler(gziphandler.GzipHandler(http.StripPrefix("/static/", http.FileServer(http.Dir(staticDir))))) + } else { + mainrouter.PathPrefix("/static/").Handler(http.StripPrefix("/static/", http.FileServer(http.Dir(staticDir)))) + } - mainrouter.Handle("/{anything:.*}", api.AppHandlerIndependent(root)).Methods("GET") + mainrouter.Handle("/{anything:.*}", api.AppHandlerIndependent(root)).Methods("GET") + } } var browsersNotSupported string = "MSIE/8;MSIE/9;MSIE/10;Internet Explorer/8;Internet Explorer/9;Internet Explorer/10;Safari/7;Safari/8" |