fix: Correct Ingress routing configuration for API and frontend
Some checks failed
Build and Deploy SQDC Dashboard / Build Docker Image (push) Successful in 1m59s
Build and Deploy SQDC Dashboard / Deploy to Kubernetes (push) Failing after 10s

- Reorder paths: /api must come before / (more specific first)
- Add path regex pattern /api(/|$)(.*) to match API requests
- Add rewrite-target annotation to strip /api prefix from backend requests
- Enable regex matching with use-regex: "true"
- Change API pathType to ImplementationSpecific for proper regex support

This fixes the 404 errors by ensuring:
1. /api/* requests are correctly routed to the API service
2. The /api prefix is stripped before reaching the Express backend
3. Frontend /* requests fall through to the React SPA

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Alexis Bruneteau 2025-10-22 23:27:30 +02:00
parent 567245a5b0
commit 0c9f5b58e0

View File

@ -5,12 +5,21 @@ metadata:
namespace: sqdc-dashboard
annotations:
nginx.ingress.kubernetes.io/ssl-redirect: "false"
nginx.ingress.kubernetes.io/rewrite-target: /$2
nginx.ingress.kubernetes.io/use-regex: "true"
spec:
ingressClassName: nginx
rules:
- host: diwii.sortifal.dev
http:
paths:
- path: /api(/|$)(.*)
pathType: ImplementationSpecific
backend:
service:
name: sqdc-api
port:
number: 3001
- path: /
pathType: Prefix
backend:
@ -18,10 +27,3 @@ spec:
name: sqdc-frontend
port:
number: 80
- path: /api/
pathType: Prefix
backend:
service:
name: sqdc-api
port:
number: 3001