[Bug][Helm chart] Path based routing doesn't work for common host
There is an issue with the helm chart for Ingress resources. We are using path based routing for multiple applications with the same host and the way Devlake helm chart creates ingress resource is based on the helm values file and the path is picked from Prefix value of helm chart. Based on how our ingresses are setup, we are supposed to give devlake as prefix. But this option doesn't seem to working since the application is looking for assets in / and throwing a 404 error in logs. So basically I am getting a blank page when I try to access https://
--
devlake:
ingress:
enabled: true
enableHttps: false
useDefaultNginx: true
annotations:
kubernetes.io/ingress.class: nginx
kubernetes.io/tls-acme: "true"
hostname: devlake-hostname.com
prefix: devlake
httpPort: 80
Ingress logs
infra-ingress-controller-ingress-nginx-controller-6bc664dbs2svg:controller 172.20.3.79 - - [19/Jun/2023:23:47:53 +0000] "GET /assets/index-afa74f6a.css HTTP/2.0" 404 548 "https://dvlake-hostname.com/devlake" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36" 366 0.001 [upstream-default-backend] [] 127.0.0.1:8181 548 0.001 404 1cad31d8fa0f700b151b7624b57aabaa
Ingress resource
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/rewrite-target: /$2
generation: 3
name: devlake
namespace: devlake
spec:
rules:
- host: devlake-hostname.com
http:
paths:
- backend:
service:
name: devlake-grafana
port:
number: 3000
path: /devlake/grafana(/|$)(.*)
pathType: Prefix
- backend:
service:
name: devlake-ui
port:
number: 4000
path: /devlake(/?|$)(.*)
pathType: Prefix
If we use prefix as / it works just fine but we are not hosting anything at the root of the url. I think this is because of the base_href path is not mentioned in index.html.
Having an option to overwrite the base_path would be ideal in this case where one can put any custom path based on their environments.
We are affected by this as well. For various infrastructure reasons, we'd really rather not use a whole subdomain just for Devlake.
hi @sais8 , I wonder even if you add rewrite nginx.ingress.kubernetes.io/rewrite-target: /$2, config-ui is still 404? In my opinion, as per your ingress resource, only grafana would get 404
@EndymionWight have you tried rewrite? could you provide your ingress config?
@ZhangNing10 We use Traefik and not nginx. So I'd really prefer the chart to support this instead of having to write extra rules for the ingress or IngressRoute.