Web UI is not working when using TEMPORAL_UI_PUBLIC_PATH when using with Kubernetes Ingress

I have deployed temporal using helm chart.

Chart.yaml

dependencies:
- name: temporal
  version: 0.46.2
  repository: https://go.temporal.io/helm-charts

And in k8s cluster I am using an NGINX Ingress controller where the path matches my-app/temporal is set to be routed to temporal web server at port 8080. All the other paths my-app/* are routed to an API gateway.

Ingress.yaml

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: my-app-api-gateway-ingress
  labels:
    app: my-app-api-gateway-ingress
  annotations:
    nginx.ingress.kubernetes.io/use-regex: "true"
    nginx.ingress.kubernetes.io/rewrite-target: /$2
    kubernetes.io/ingress.class: "nginx"
spec:
  rules:
    - http:
        paths:
          - path: /my-app/temporal
            pathType: Prefix
            backend:
              service:
                name: my-app-temporal-web
                port:
                  number: 8080
          - path: /my-app(/|$)(.*)
            pathType: ImplementationSpecific
            backend:
              service:
                name: my-app-api-gateway
                port:
                  number: {{ .Values.service.apiGatewayPort }}

Also, I have set the TEMPORAL_UI_PUBLIC_PATH to /my-app/temporal. But now when I visit the URL the web UI fails:

Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/html". Strict MIME type checking is enforced for module scripts per HTML spec.
temporal:1 Uncaught (in promise) TypeError: Failed to fetch dynamically imported module: http://123.10.10.1/my-app/temporal/_app/immutable/entry/start.C0f7LuXq.js
entry.DjAoTxOI.js:1 Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/html". Strict MIME type checking is enforced for module scripts per HTML spec.
paths.CtNUYiE4.js:1 Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/html". Strict MIME type checking is enforced for module scripts per HTML spec.
scheduler.DZa-jdu7.js:1 Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/html". Strict MIME type checking is enforced for module scripts per HTML spec.
control.CYgJF_JY.js:1 Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/html". Strict MIME type checking is enforced for module scripts per HTML spec.
app.CpSvyuBJ.js:1 Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/html". Strict MIME type checking is enforced for module scripts per HTML spec.
preload-helper.D6kgxu3v.js:1 Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/html". Strict MIME type checking is enforced for module scripts per HTML spec.
index.CUEbpWiv.js:1 Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/html". Strict MIME type checking is enforced for module scripts per HTML spec.

Having the same issue on my end. Did you ever figure this out?

If anyone else runs into this issue: I didn’t have the TEMPORAL_UI_PUBLIC_PATH set correctly to the root of my application.