commerce-ingress: redirect root to /app instead of 404ing

commerce.cruzcloud.net (medusa-svc) has no route at "/" — Medusa only
serves /health, /app (admin), /store, etc. lab-agent's generic public
domain check flagged the resulting 404 as an anomaly every cycle even
though the service is healthy.

Adds a Traefik Middleware (redirectRegex) scoped to the commerce host
that 301s "/" to "/app", so the DNS/routing layer owns the entry point
instead of every client (including monitoring) having to know to
append /app manually. Regex includes the host explicitly because the
same Ingress also routes media.cruzcloud.net and shares
router.middlewares at the Ingress-annotation level.
This commit is contained in:
devops committed 2026-08-26 13:29:41 -05:00
1 parent 56ab9d1862
commit 0189f2369e
3 files changed
+18

No files matched your search

@@ -4,6 +4,7 @@ metadata:
name: commerce-ingress
annotations:
traefik.ingress.kubernetes.io/router.entrypoints: web
traefik.ingress.kubernetes.io/router.middlewares: ecommerce-commerce-redirect-app@kubernetescrd
spec:
ingressClassName: traefik
rules:
@@ -9,3 +9,4 @@ resources:
- minio-bootstrap-job.yaml
- medusa/
- ingress-commerce.yaml
- middleware-commerce-redirect.yaml
@@ -0,0 +1,16 @@
apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
name: commerce-redirect-app
spec:
# Redirige solo la raíz exacta de commerce.cruzcloud.net a /app (admin de
# Medusa) — el regex incluye el host a propósito: esta Middleware se
# referencia desde el mismo Ingress que también enruta media.cruzcloud.net,
# y sin el host en el regex un request a la raíz de ese otro dominio
# también matchearía (ambas rutas comparten Ingress -> mismas
# router.middlewares). Si el regex no matchea, Traefik deja pasar el
# request sin modificarlo.
redirectRegex:
regex: "^https?://commerce\\.cruzcloud\\.net/$"
replacement: "https://commerce.cruzcloud.net/app"
permanent: true