GZIP: Enable compression before API routes are registered #4018

Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
Michael Mayer 2024-01-19 22:46:31 +01:00
parent 526867347a
commit d98a1cb2ab

View file

@ -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()...)