Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate running lens under a reverse proxy #2519

Closed
codefromthecrypt opened this issue Apr 19, 2019 · 8 comments · Fixed by #2987
Closed

Validate running lens under a reverse proxy #2519

codefromthecrypt opened this issue Apr 19, 2019 · 8 comments · Fixed by #2987
Labels

Comments

@codefromthecrypt
Copy link
Member

#1946 implemented reverse proxy configuration, where zipkin was mounted alongside other services. This was addressed by an env variable ZIPKIN_UI_BASEPATH described below:

path prefix placed into the tag in the UI HTML; useful when running behind a reverse proxy. Default "/zipkin"

We need to read that variable from /config.json in lens, then ping @wdittmer @abesto to verify later (unless one of them wants to help implement!)

@jcchavezs
Copy link
Contributor

jcchavezs commented Apr 19, 2019 via email

@shakuzen
Copy link
Member

I think we have some expertise in my company I could borrow.

@jcchavezs just checking back to see if you or someone from your company would be able to help resolve this (it's one of the issues blocking switching the default UI to Lens).

@jorgheymans
Copy link
Contributor

I tested this with mod_proxy and a local httpd running on 8080

ProxyPass "/myzipkin"  "http://localhost:9411/zipkin"
ProxyPassReverse "/myzipkin"  "http://localhost:9411/zipkin"

Started zipkin-server using java -jar target/zipkin-server-2.16.3-SNAPSHOT-exec.jar --zipkin.ui.basepath=/myzipkin

Then accessing http://localhost:8080/myzipkin ends up loading lens correctly but the browser url becomes http://localhost:8080/zipkin/ which does not seem desired.

@codefromthecrypt
Copy link
Member Author

great. Thanks @jorgheymans. this is progress

codefromthecrypt pushed a commit that referenced this issue Feb 4, 2020
For well over a year, we've been working on Lens, most notably @tacigar.

In fact a year ago, we added a "Try Lens" button and addressed a lot of
feedback from that, again largely thanks to @tacigar.

It isn't fair to hold the project hostage until some notion of
perfection happens. It is also unfair for people to pick certain issues
to block on, yet not volunteer to help. It is of my opinion we stop
holding ourselves hostage to a maintenance pit and remove the burden and
confusion of two UIs.

This concedes the following just won't work until someone volunteers to
fix them. Waiting a year hasn't done it, so waiting more won't either.

* ZIPKIN_UI_BASEPATH for reverse proxy #2519
* ZIPKIN_UI_LOGS_URL #2491
* /config.json config overrides #2969
* Chinese language support #2970
codefromthecrypt pushed a commit that referenced this issue Feb 10, 2020
For well over a year, we've been working on Lens, most notably @tacigar.

In fact a year ago, we added a "Try Lens" button and addressed a lot of
feedback from that, again largely thanks to @tacigar.

It isn't fair to hold the project hostage until some notion of
perfection happens. It is also unfair for people to pick certain issues
to block on, yet not volunteer to help. It is of my opinion we stop
holding ourselves hostage to a maintenance pit and remove the burden and
confusion of two UIs.

This concedes the following just won't work until someone volunteers to
fix them. Waiting a year hasn't done it, so waiting more won't either.

* ZIPKIN_UI_BASEPATH for reverse proxy #2519
* ZIPKIN_UI_LOGS_URL #2491
* /config.json config overrides #2969
* Chinese language support #2970
@anuraaga
Copy link
Contributor

anuraaga commented Feb 22, 2020

I'm looking at this issue. I know in #1946 we added a mechanism for injecting the base path from the server to read in the client. But wondering, does anyone remember if there was any gotcha from just trying to extract the base path from the current window.location?

I think a URL that renders zipkin-lens can only look like one of these patterns

So simple processing of window.location.href can find that the base path is https://fooserver.com/mysite/myzipkin/

One corner case is if a user enters there own 404 URL like this

With just parsing of the URL, we would end up treating this as a base path (the URL to the discover page) of https://fooserver.com/mysite/myzipkin/foobar/. Ideally, the reverse proxy itself throw the 404 for this, but in case it doesn't, we'd still be able to do it though if we treat a 404 for BASE_PATH/config.json as a 404 page. This doesn't seem too high priority to me though since we're already not very good, lens displays a blank confusing page if a request of an unknown path does make it through (e.g., when using the dev server) so any handling of bad URLs would be an improvement regardless of base path handling.

Interpreting the base path would allow users to proxy without even worrying about setting a property. And it simplifies our dev server too by removing the dev-only API_BASE environment variable.

Let me know if you have any concerns about such an approach. /cc @abesto

@jcchavezs
Copy link
Contributor

jcchavezs commented Feb 22, 2020 via email

@anuraaga
Copy link
Contributor

anuraaga commented Feb 22, 2020

Yup lens uses react-router. I'm hoping to extract the base path from window.location and pass it to react-router using the basename prop (as well as using it to configure API calls)

@jcchavezs
Copy link
Contributor

jcchavezs commented Feb 22, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants