diff --git a/pkg/config/config.go b/pkg/config/config.go index d135be288..0d3e91b88 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -599,6 +599,9 @@ func InitConfig() { if DefaultSettingsTimezone.GetString() == "" { DefaultSettingsTimezone.Set(ServiceTimeZone.GetString()) } + + publicURL := strings.TrimSuffix(ServicePublicURL.GetString(), "/") + CorsOrigins.Set(append(CorsOrigins.GetStringSlice(), publicURL)) } func random(length int) (string, error) { diff --git a/pkg/routes/routes.go b/pkg/routes/routes.go index 4bd67a4d0..ea2ae1440 100644 --- a/pkg/routes/routes.go +++ b/pkg/routes/routes.go @@ -182,6 +182,7 @@ func RegisterRoutes(e *echo.Echo) { // CORS if config.CorsEnable.GetBool() { + log.Debugf("CORS enabled with origins: %s", strings.Join(config.CorsOrigins.GetStringSlice(), ", ")) e.Use(middleware.CORSWithConfig(middleware.CORSConfig{ AllowOrigins: config.CorsOrigins.GetStringSlice(), MaxAge: config.CorsMaxAge.GetInt(),