diff --git a/pkg/domain/app_website.go b/pkg/domain/app_website.go index 31bf3bfcb..2fbb4fb82 100644 --- a/pkg/domain/app_website.go +++ b/pkg/domain/app_website.go @@ -151,6 +151,10 @@ func (w *Website) Validate() error { return nil } +func (w *Website) Normalize() { + w.FQDN = strings.ToLower(w.FQDN) +} + func (w *Website) pathComponents() []string { // NOTE: empty PathPrefix must not exist if w.PathPrefix == "/" { diff --git a/pkg/usecase/apiserver/app_service.go b/pkg/usecase/apiserver/app_service.go index 7d338f146..89b5fbee8 100644 --- a/pkg/usecase/apiserver/app_service.go +++ b/pkg/usecase/apiserver/app_service.go @@ -62,6 +62,9 @@ func (s *Service) CreateApplication(ctx context.Context, app *domain.Application } app.OwnerIDs = repo.OwnerIDs + for _, website := range app.Websites { + website.Normalize() + } // Validate err = s.validateApp(ctx, app) if err != nil { @@ -213,6 +216,9 @@ func (s *Service) UpdateApplication(ctx context.Context, id string, args *domain } app.Apply(args) + for _, website := range app.Websites { + website.Normalize() + } // Validate if err = s.validateApp(ctx, app); err != nil { return err