opencost / opencost-ui

The OpenCost web interface
https://opencost-ui.vercel.app
Apache License 2.0
7 stars 7 forks source link

Change the context path. #6

Open polinchw opened 11 months ago

polinchw commented 11 months ago

Is your feature request related to a problem? Please describe.

I'm trying to run Opencost on Kubernetes with a Traefik Ingress route. The hostname we have is common say https://example.com. I'd like to have Opencost listen on https://example.com/opencost. I'm having issues routing to Opencost with it listening on the root context /.

Describe the solution you'd like

Is it possible to make Opencost listen on context like /opencost?

Describe alternatives you've considered

I've tried different Middlewares in Traefik to direct it to Opencost but I haven't had any luck.

mattray commented 11 months ago

Related to https://github.com/opencost/opencost-helm-chart/issues/148

niklastanner commented 11 months ago

opencost/opencost-helm-chart#148 did not solve the problem.

Helm chart values:

opencost:
  ui:
    ingress:
      hosts:
        - host: my.url.com
          paths:
            - /opencost
      tls:
        - hosts:
            - my.url.com
    extraEnv: # Tried with both simultaneously and with each env-variable alone
      - name: BASE_URL
        value: /opencost/model
      - name: BASE_URL_OVERRIDE
        value: /opencost

exec into opencost-ui:

$ echo $BASE_URL_OVERRIDE
/opencost
$ echo $BASE_URL
/opencost/model

When calling the UI over the browser (https://my.url.com/opencost), an empty white page is being served. Network Protocol shows:

https://my.url.com/opencost - GET - 200 OK
https://my.url.com/index.89ba2f7f.css - GET - 404 Not Found
https://my.url.com/index.a13ddd66.js - GET - 404 Not Found
https://my.url.com/favicon.7eff484d.ico - GET - 404 Not Found

The ui files (index.js, etc.) should be taken from the subpath (e.g. https://my.url.com/opencost/index.a13ddd66.js) not from /

Both Pods opencost and opencost-ui do not show any logs.

sethiharsh commented 11 months ago

we are facing same issue to access opencost-ui on ingress sub paths.

dlahn commented 7 months ago

We are facing the same issue. Any updates here?

victor-a-valencia commented 5 months ago

Same issue here. Any updates?

dwbrown2 commented 5 months ago

@mattray anything you can share?

mattray commented 5 months ago

I haven't had time to address this, but I'll bump the priority