diff --git a/internal/registry/httpserver/endpoints.go b/internal/registry/httpserver/endpoints.go index f06b1ee7..408b5182 100644 --- a/internal/registry/httpserver/endpoints.go +++ b/internal/registry/httpserver/endpoints.go @@ -2,12 +2,18 @@ package httpserver import ( "context" + "net/http" "vc/internal/gen/status/apiv1_status" "vc/internal/registry/apiv1" "github.com/gin-gonic/gin" ) +func (s *Service) endpointRootRedirect(ctx context.Context, c *gin.Context) (any, error) { + c.Redirect(http.StatusFound, "/admin/login") + return nil, nil +} + func (s *Service) endpointHealth(ctx context.Context, c *gin.Context) (any, error) { request := &apiv1_status.StatusRequest{} reply, err := s.apiv1.Status(ctx, request) diff --git a/internal/registry/httpserver/service.go b/internal/registry/httpserver/service.go index fcc3c9b3..da1f9842 100644 --- a/internal/registry/httpserver/service.go +++ b/internal/registry/httpserver/service.go @@ -80,6 +80,9 @@ func New(ctx context.Context, cfg *model.Cfg, api *apiv1.Client, tracer *trace.T SameSite: http.SameSiteStrictMode, } + // Redirect root to admin login + s.httpHelpers.Server.RegEndpoint(ctx, rgRoot, http.MethodGet, "", http.StatusFound, s.endpointRootRedirect) + rgAdmin := rgRoot.Group("/admin") // Public routes (no auth required) s.httpHelpers.Server.RegEndpoint(ctx, rgAdmin, http.MethodGet, "/login", http.StatusOK, s.endpointAdminLoginPage)