browser-assets: serve asset files with compression.

This commit is contained in:
Krishna Srinivas
2016-03-04 07:45:56 +05:30
parent 8bf882e5c0
commit 44b2037667
11 changed files with 1226 additions and 1 deletions

View File

@@ -22,6 +22,7 @@ import (
"net/http"
"github.com/elazarl/go-bindata-assetfs"
"github.com/gorilla/handlers"
router "github.com/gorilla/mux"
jsonrpc "github.com/gorilla/rpc/v2"
"github.com/gorilla/rpc/v2/json2"
@@ -99,7 +100,7 @@ func registerAPIHandlers(mux *router.Router, a storageAPI, w *webAPI) {
// RPC handler at URI - /minio/rpc
minio.Path("/rpc").Handler(rpc)
// Serve all assets.
minio.Path(fmt.Sprintf("/{assets:[^/]+.js|%s}", specialAssets)).Handler(http.StripPrefix(privateBucket, http.FileServer(assetFS())))
minio.Path(fmt.Sprintf("/{assets:[^/]+.js|%s}", specialAssets)).Handler(handlers.CompressHandler(http.StripPrefix(privateBucket, http.FileServer(assetFS()))))
// Serve index.html for rest of the requests
minio.Path("/{index:.*}").Handler(indexHandler{http.StripPrefix(privateBucket, http.FileServer(assetFS()))})