Add gzip compression using gzip middleware

This commit is contained in:
video-prize-ranch 2024-02-25 00:15:33 -05:00
parent 7e80ade24b
commit 1568e97bac
No known key found for this signature in database
3 changed files with 6 additions and 2 deletions

View file

@ -11,6 +11,7 @@ import (
"strings"
"time"
"github.com/klauspost/compress/gzhttp"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
"github.com/urfave/cli/v2"
@ -131,8 +132,8 @@ func Serve(ctx *cli.Context) error {
}()
}
// Create ssl handler based on settings
sslHandler := handler.Handler(cfg.Server, giteaClient, dnsLookupCache, canonicalDomainCache, redirectsCache)
// Create ssl handler based on settings, with gzip compression
sslHandler := gzhttp.GzipHandler(handler.Handler(cfg.Server, giteaClient, dnsLookupCache, canonicalDomainCache, redirectsCache))
// Start the ssl listener
log.Info().Msgf("Start SSL server using TCP listener on %s", listener.Addr())