From 735ba7aebfd8baee12f6748b92411ae26af69a4c Mon Sep 17 00:00:00 2001 From: Jannik Stehle Date: Fri, 31 May 2024 12:34:12 +0200 Subject: [PATCH] feat: web server compression Adds a compression middleware to the web server to reduce the request size when delivering static files. This speeds up loading times in web clients. The chi middleware we're using for this currently supports `gzip` as compression algorithm. We might want to extend this to support `br` (Brotli) in the future, since it's a newer and more performant algorithm. --- changelog/unreleased/enhancement-web-server-compression.md | 6 ++++++ services/web/pkg/server/http/server.go | 1 + 2 files changed, 7 insertions(+) create mode 100644 changelog/unreleased/enhancement-web-server-compression.md diff --git a/changelog/unreleased/enhancement-web-server-compression.md b/changelog/unreleased/enhancement-web-server-compression.md new file mode 100644 index 000000000..c4e2ecb5a --- /dev/null +++ b/changelog/unreleased/enhancement-web-server-compression.md @@ -0,0 +1,6 @@ +Enhancement: Web server compression + +We've added a compression middleware to the web server to reduce the request size when delivering static files. This speeds up loading times in web clients. + +https://github.com/owncloud/ocis/pull/9287 +https://github.com/owncloud/web/issues/7964 diff --git a/services/web/pkg/server/http/server.go b/services/web/pkg/server/http/server.go index 012c3ccf4..bc8bed9af 100644 --- a/services/web/pkg/server/http/server.go +++ b/services/web/pkg/server/http/server.go @@ -99,6 +99,7 @@ func Server(opts ...Option) (http.Service, error) { svc.Middleware( chimiddleware.RealIP, chimiddleware.RequestID, + chimiddleware.Compress(5), middleware.NoCache, webmid.SilentRefresh, middleware.Version(