diff --git a/engine/api/router_middleware.go b/engine/api/router_middleware.go index bf61f17677..58a77abef8 100644 --- a/engine/api/router_middleware.go +++ b/engine/api/router_middleware.go @@ -9,8 +9,11 @@ import ( ) func (api *API) maintenanceMiddleware(ctx context.Context, w http.ResponseWriter, req *http.Request, rc *service.HandlerConfig) (context.Context, error) { - if !isMaintainer(ctx) && api.Maintenance && !rc.MaintenanceAware && rc.Method != http.MethodGet { - return ctx, sdk.WrapError(sdk.ErrServiceUnavailable, "CDS Maintenance ON") + if api.Maintenance && !rc.MaintenanceAware && rc.Method != http.MethodGet { + isAllowed := isMaintainer(ctx) || isService(ctx) || isWorker(ctx) + if !isAllowed { + return ctx, sdk.WrapError(sdk.ErrServiceUnavailable, "CDS Maintenance ON") + } } return ctx, nil }