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

Hosting zipkin UI through a proxy #1452

Closed
raiRaiyan opened this issue Dec 22, 2016 · 19 comments
Closed

Hosting zipkin UI through a proxy #1452

raiRaiyan opened this issue Dec 22, 2016 · 19 comments
Labels

Comments

@raiRaiyan
Copy link

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?

@codefromthecrypt
Copy link
Member

codefromthecrypt commented Dec 22, 2016 via email

@raiRaiyan raiRaiyan reopened this Dec 22, 2016
@raiRaiyan
Copy link
Author

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

@codefromthecrypt
Copy link
Member

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?

@eirslett
Copy link
Contributor

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.

@codefromthecrypt
Copy link
Member

@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?

@eirslett
Copy link
Contributor

/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.

@codefromthecrypt
Copy link
Member

codefromthecrypt commented Dec 22, 2016

@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

@eirslett
Copy link
Contributor

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

@codefromthecrypt
Copy link
Member

dupe of #1229

codefromthecrypt pushed a commit that referenced this issue Jun 23, 2017
This moves the zipkin UI under the path /zipkin, adding a redirect for
/ as well. As UI assets look for the api to be relative to it, requests
to /zipkin/api are forwarded to /api, too.

Fixes #1229 #1452
codefromthecrypt pushed a commit that referenced this issue Jun 24, 2017
This moves the zipkin UI under the path /zipkin, adding a redirect for
/ as well. As UI assets look for the api to be relative to it, requests
to /zipkin/api are forwarded to /api, too.

Fixes #1229 #1452
danielkwinsor pushed a commit to danielkwinsor/zipkin that referenced this issue Jun 28, 2017
This moves the zipkin UI under the path /zipkin, adding a redirect for
/ as well. As UI assets look for the api to be relative to it, requests
to /zipkin/api are forwarded to /api, too.

Fixes openzipkin#1229 openzipkin#1452
danielkwinsor pushed a commit to danielkwinsor/zipkin that referenced this issue Jun 28, 2017
This moves the zipkin UI under the path /zipkin, adding a redirect for
/ as well. As UI assets look for the api to be relative to it, requests
to /zipkin/api are forwarded to /api, too.

Fixes openzipkin#1229 openzipkin#1452
danielkwinsor pushed a commit to danielkwinsor/zipkin that referenced this issue Jun 28, 2017
This moves the zipkin UI under the path /zipkin, adding a redirect for
/ as well. As UI assets look for the api to be relative to it, requests
to /zipkin/api are forwarded to /api, too.

Fixes openzipkin#1229 openzipkin#1452
@saturnism
Copy link

@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?

@codefromthecrypt
Copy link
Member

codefromthecrypt commented Sep 26, 2017 via email

@brunouska
Copy link

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...

@codefromthecrypt
Copy link
Member

codefromthecrypt commented Mar 31, 2018 via email

@momentum123
Copy link

momentum123 commented Apr 14, 2018

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

@brunouska
Copy link

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

@momentum123
Copy link

momentum123 commented Apr 14, 2018

@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

@brunouska
Copy link

brunouska commented Apr 15, 2018

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.

@brunouska
Copy link

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

@momentum123
Copy link

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

abesto pushed a commit to abesto/zipkin that referenced this issue Sep 10, 2019
This moves the zipkin UI under the path /zipkin, adding a redirect for
/ as well. As UI assets look for the api to be relative to it, requests
to /zipkin/api are forwarded to /api, too.

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

No branches or pull requests

6 participants