Zipkin: Hosting zipkin UI through a proxy

Created on 22 Dec 2016  ·  19Comments  ·  Source: openzipkin/zipkin

The zipkin ui that is hosted when a java zipkin server is launched is accessible only through the hostname of the machine where the ui is hosted.
Like http://localhost:9411/

If the request to the ui is proxied through a gateway, the UI becomes inaccessible.
Like http://abcd.com/zipkin/

The problem seems to be the app.js bundle file for the ui is not requested relatively. The request is something like http://abcd.com/app.js/, whereas this request should also be proxied http://abcd.com/zipkin/app.js

Looking into it, I figured that publicPath in webpack.config file is specified as /, which makes the requests non relative.

Even after changing that, all the jquery requests that the ui makes to retreive the data is not proxied.
Can this be changed, maybe accept a basePath property in config.json of the ui, which will allow the ui to be proxied? Or is there already a way to do this?

enhancement ui

Most helpful comment

The problem is with crossroads, which doesn't know what to serve (which route) if it doesn't know about the context path.

All 19 comments

assumption here is that you cannot deploy the UI assets to the proxy? ex
https://github.com/openzipkin/docker-zipkin/tree/master/zipkin-ui

On Thu, Dec 22, 2016 at 12:48 PM, raiRaiyan notifications@github.com
wrote:

The zipkin ui that is hosted when a java zipkin server is launched is
accessible only through the hostname of the machine where the ui is hosted.
Like http://localhost:9411/

If the request to the ui is proxied through a gateway, the UI becomes
inaccessible.
Like http://abcd.com/zipkin/

The problem seems to be the app.js bundle file for the ui is not
requested relatively. The request is something like
http://abcd.com/app.js/, whereas this request should also be proxied
http://abcd.com/zipkin/app.js

Looking into it, I figured that publicPath in webpack.config file is
specified as /, which makes the requests non relative.

Even after changing that, all the jquery requests that the ui makes to
retreive the data is not proxied.
Can this be changed, maybe accept a basePath property in config.json of
the ui, which will allow the ui to be proxied? Or is there already a way to
do this?


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/openzipkin/zipkin/issues/1452, or mute the thread
https://github.com/notifications/unsubscribe-auth/AAD619tYiQpEAAJ0Fm5tugyDTqf5kjrbks5rKgE7gaJpZM4LToyx
.

@adriancole The ui itself is not accessible when proxied. The index.html requests for a file /app.js non relatively.

oh right.. you are talking about proxying, and also hosting under a different path.

can you please find the existing issue on this and close this as a dupe?

Ok, here is the solution we can implement (it was discussed before) Always serve the zipkin ui under a context path, like /zipkin/. Any requests that don't start with that URL will automatically be forwarded. That means there will be no special handling when using a proxy.

@eirslett seems right, since iirc most are asking for that specific path anyway :) We'd have to whitelist quite a few things, like the api config health checks, etc. Maybe we forward the root itself or is a whitelist ok?

/api/ can be duplicate-served under /zipkin/api/ for a while, I guess not all http clients people use handle 302? But all browsers will.

@eirslett what if we did it the other way.. we change the content to use paths of /zipkin, and mount the UI assets both under /zipkin and also under root. Might be naive, but could that solve the migration problem as well? cc @abesto

The problem is with crossroads, which doesn't know what to serve (which route) if it doesn't know about the context path.

dupe of #1229

@adriancole i ran into a similar issue recently. If I hit Zipkin host from a proxied host, e.g. http://myzipkin.tld/ it'll redirect me to http://127.0.0/1/zipkin. But if I hit the context root, http://myzipkin.tld/zipkin then it's loads fine.

Is there any chance to redirect to context w/ relative URL?

Is there any chance to redirect to context w/ relative URL?

Possible. Can you weigh in on https://github.com/openzipkin/zipkin/pull/1732
and open an issue about relative url if not ok. There are a few issues like
this and want to reduce any overlap complexity

Cheers!

I was able to make it happen with Zipkin latest version, 2.5.3, using “zipkin.ui.basepath”. I have Zipkin behind Zuul, with service discovery working like a charm. In my Zuul routes I have mapped Zipkin to “/api/trace/**”, pointing to “zipkin-service” as registered in Eureka and at Zipkin YML config, my “zipkin.ui.basepath” points to “/api/trace/zipkin”. With this settings I can run for “http://localhost:8080/api/trace/“ and all redirects works. Hope it help another people. Passed two days figuring out what to do...

thanks so much for sharing!

hi@brunouska how are u accessing zipkin thru serviceid or url.

@momentum123, I’m accessing zipkin by Zuul exposed url. Zuul uses Service id at route mapping.

@brunouska i have tried the same but doesnt work for me tried on earlier version and 2.5.3 and on 2.7.1
doesnt work on any of them please tell me if im doing something wrong and given that im setting the property on jar invocation : java -Dzipikin.ui.basepath=/api/trace/zipkin -jar zipkin.jar
setting property
zipkin.ui.basepath=/api/trace/zipkin

zuul.routes.zipkin.path=/api/trace/

zuul.routes.zipkin.url=http://localhost:9411

accessing thru gateway

https://localhost:443/api/trace

getting same broken ui without any changes

https://localhost:443/zipkin

i have tried a workaround in #1993 works partially: ui

Let's go @momentum123,

My Spring Boot Version for my implementation is 1.5.9.RELEASE
My Spring Cloud Version for my implementation is Edgware.RELEASE

Here's my Zuul routes config, at my YML:

zuul:
ignored-services: ""
prefix: /api
routes:
trace:
path: /tracing/
*
serviceId: bahauser-trace-server

Here's my Zipkin Config, at my YML:

eureka:
instance:
lease-renewal-interval-in-seconds: 5
instance-id: ${spring.application.name}:${vcap.application.instance_id:${spring.application.instance_id:${random.value}}}
prefer-ip-address: true
client:
registryFetchIntervalSeconds: 5
region: default
service-url:
defaultZone: http://${bahauser-discovery-server.username}:${bahauser-discovery-server.password}@${bahauser-discovery-server.host}:${bahauser-discovery-server.port}/eureka/

zipkin:
ui:
basepath: /api/tracing/zipkin

When accessing Zipkin thru Zuul, i use "http://localhost:8080/api/tracing/zipkin/", note the "/" at the end, you have to put it in order to access the UI. You can handle this with a redirection if you want it, at my needing this not a issue. Try with this settings.

You can not get it working we could make a git repository only with the modules involved. I have so many other things, like rabbitmq, auth, so on... If you can not get working I put something at Git Hub for you.

This was a little tricky for me to get working, pay attention to the minimum details at your configuration.

sorry for the really late reply. thanx the above solution worked like a charm for me

Was this page helpful?
0 / 5 - 0 ratings