diff options
author | Christopher Speller <crspeller@gmail.com> | 2016-03-17 12:04:51 -0400 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2016-03-17 12:04:51 -0400 |
commit | a6a9dd76914b33d292a54d667ce6789c2b6b4b41 (patch) | |
tree | a3a358fbb7cb8b272ce846965430276a4717ebfd /web/web.go | |
parent | 1fe2f7301a03f1051245fc38492c2ad4f5357de3 (diff) | |
parent | fdc3207724fde8c0c3fae7e18d7ec8463e72e737 (diff) | |
download | chat-a6a9dd76914b33d292a54d667ce6789c2b6b4b41.tar.gz chat-a6a9dd76914b33d292a54d667ce6789c2b6b4b41.tar.bz2 chat-a6a9dd76914b33d292a54d667ce6789c2b6b4b41.zip |
Merge pull request #2462 from mattermost/plt-2340
PLT-2340 Webpack optimizations and fixes
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" |