linkerd2 icon indicating copy to clipboard operation
linkerd2 copied to clipboard

linkerd2 web does not support relative paths

Open ctaggart opened this issue 7 years ago • 11 comments

Bug Report

I want to be able to proxy the web UI in a subdirectory or kubectl proxy, but it currently requires to be at the root path. That is a bug.

image

What is the issue?

How can it be reproduced?

Logs, error output, etc

(If the output is long, please create a gist and paste the link here.)

linkerd check output

kubernetes-api: can initialize the client..................................[ok]
kubernetes-api: can query the Kubernetes API...............................[ok]
kubernetes-api: is running the minimum Kubernetes API version..............[ok]
linkerd-api: control plane namespace exists................................[ok]
linkerd-api: control plane pods are ready..................................[ok]
linkerd-api: can initialize the client.....................................[ok]
linkerd-api: can query the control plane API...............................[ok]
linkerd-api[kubernetes]: control plane can talk to Kubernetes..............[ok]
linkerd-api[prometheus]: control plane can talk to Prometheus..............[ok]
linkerd-api: no invalid service profiles...................................[ok]
linkerd-version: can determine the latest version..........................[ok]
linkerd-version: cli is up-to-date.........................................[ok]
linkerd-version: control plane is up-to-date...............................[ok]

Status check results are [ok]

Environment

  • Kubernetes Version:
  • Cluster Environment: (GKE, AKS, kops, ...)
  • Host OS:
  • Linkerd version: Client version: stable-2.1.0 Server version: stable-2.1.0

Possible solution

Use a relative path of dist instead of /dist and so on.

Additional context

ctaggart avatar Dec 07 '18 03:12 ctaggart

I'd very much like to be able to get to the dashboard through a reverse proxy and really need to be able to support relative paths or the ability to set a root_url path that everything then uses.

robertrbruno avatar Dec 13 '18 16:12 robertrbruno

Thanks @robertrbruno @ctaggart!

wmorgan avatar Dec 15 '18 01:12 wmorgan

This relates to #1696, which explores the idea of accessing the dashboards via port-forward, which would make the web/grafana setup more straightforward and hopefully allow us to support relative paths.

klingerf avatar Dec 17 '18 22:12 klingerf

@klingerf I see #1696 was fixed a week ago by #2052. Any chance this was or can also be resolved? I can't get linkerd back into our labs until this is resolved.

ctaggart avatar Jan 17 '19 16:01 ctaggart

In #2052 we moved to using port-forward, which means that the web UI is served from "/" and the grafana UI is served from "/grafana", but neither support being served on arbitrary paths, so I'm afraid this issue is still not fixed. The main benefit from #2052 is that you can now expose both web and grafana via an ingress controller. If serving on arbitrary paths is still required, then that would require additional code changes, and I'd welcome a PR for such a change.

klingerf avatar Jan 18 '19 00:01 klingerf

Is there any update on supporting the use of Linkerd web on relative paths?

lyndon160 avatar Aug 22 '19 12:08 lyndon160

@lyndon160 Curious if using the ingress approach will serve your needs here?

ihcsim avatar Aug 22 '19 16:08 ihcsim

@lyndon160 this issue is still open. We'd love PRs!

@ihcsim the problem is because of the SPA and URL paths.

grampelberg avatar Aug 22 '19 16:08 grampelberg

Use a relative path of dist instead of /dist and so on.

This unfortunately won't quite cut it with the current setup, and in fact will break the app. The problem is that the backend is handling every route on the initial request and serving the SPA from there.

That means when requesting /namespaces/linkerd, instead of pointing to /dist/index_bundle.js, the bundle would point to /namespaces/linkerd/dist/index_bundle.js, which is obviously wrong.

IMHO the underlying problem is how routing is done. It probably should be handled by the frontend, especially since almost all the current backend routing is calling the same handler (handleIndex). Unless there is a really, really good reason not to.

After that, using relative path's for assets and React-Router's basename would fix the issue.

MoSattler avatar Sep 26 '22 13:09 MoSattler

Let me take this issue @ctaggart Please assign

ashutosh887 avatar May 03 '23 02:05 ashutosh887

Hi @ashutosh887,

You don't need this issue assigned in order to start work on it. Feel free to just submit a PR or reach out if you have questions.

adleong avatar May 11 '23 01:05 adleong