From d98a1cb2ab1a237f926c6c0e57c090bebb18c3ba Mon Sep 17 00:00:00 2001 From: Michael Mayer Date: Fri, 19 Jan 2024 22:46:31 +0100 Subject: [PATCH] GZIP: Enable compression before API routes are registered #4018 Signed-off-by: Michael Mayer --- internal/server/start.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/server/start.go b/internal/server/start.go index c0c01bd96..4adf16cfd 100644 --- a/internal/server/start.go +++ b/internal/server/start.go @@ -44,12 +44,6 @@ func Start(ctx context.Context, conf *config.Config) { // Register common middleware. router.Use(Recovery(), Security(conf), Logger()) - // Create REST API router group. - APIv1 = router.Group(conf.BaseUri(config.ApiUri), Api(conf)) - - // Initialize package extensions. - Ext().Init(router, conf) - // Enable HTTP compression? switch conf.HttpCompression() { case "gzip": @@ -66,6 +60,12 @@ func Start(ctx context.Context, conf *config.Config) { log.Infof("server: enabled gzip compression") } + // Create REST API router group. + APIv1 = router.Group(conf.BaseUri(config.ApiUri), Api(conf)) + + // Initialize package extensions. + Ext().Init(router, conf) + // Find and load templates. router.LoadHTMLFiles(conf.TemplateFiles()...)