1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-19 13:29:41 +02:00

feat: gzip static resources (#6258)

This commit is contained in:
Dmitry Salakhov 2021-12-13 22:34:55 +13:00 committed by GitHub
parent 76916b0ad6
commit eb517c2e12
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 4 deletions

View file

@ -3,6 +3,8 @@ package file
import (
"net/http"
"strings"
"github.com/gorilla/handlers"
)
// Handler represents an HTTP API handler for managing static files.
@ -13,8 +15,11 @@ type Handler struct {
// NewHandler creates a handler to serve static files.
func NewHandler(assetPublicPath string) *Handler {
h := &Handler{
Handler: http.FileServer(http.Dir(assetPublicPath)),
Handler: handlers.CompressHandler(
http.FileServer(http.Dir(assetPublicPath)),
),
}
return h
}