Thanos, Prometheus and Golang version used:
Using official docker image: thanosio/thanos:v0.15.0
Object Storage Provider: Ceph storage blocks
What happened:
I am using Thanos tools bucket web with --web.external-prefix=/thanos/bucket. Once I hit URL http://localhost:9090/thanos/bucket (k8s service being forwarded to 9090 from 10902 internally), I get 404. When I hit http://localhost:9090 then it shows HTML links only, and when I click on any link it routes me via a prefix path which is okay but again 404. When going through the documentation, I found
--web.external-prefix="" Static prefix for all HTML links and redirect
URLs in the bucket web UI interface. Actual
endpoints are still served on / or the
web.route-prefix. This allows thanos bucket web
UI to be served behind a reverse proxy that
strips a URL sub-path.
Flagweb.route-prefix is mentioned but bucket web does not support it.
I faced a similar issue with the querier and it got resolved when I used web.route-prefix flag.
When I am trying to use this flag for Thanos tools bucket web, it says there is not support for the flag web.route-prefix.
What you expected to happen:
Bucket web UI should be loaded behind the proxy and this can be done by providing support of web.route-prefix flag which is missing as of now.
How to reproduce it (as minimally and precisely as possible):
1
containers:
- name: thanos-bucketweb
image: thanosio/thanos:v0.15.0
imagePullPolicy: IfNotPresent
args:
- tools
- bucket
- web
- --log.level=info
- --http-address=0.0.0.0:10902
- --web.external-prefix=thanos/bucket
- --refresh=30m
- --objstore.config-file=/etc/thanos-store/ceph-object-storage.yaml
2 http://localhost:9090/thanos/bucket 404 page not found
3 http://localhost:9090 HTML UI is displayed and then 404 page not found after clicking a link
Full logs to relevant components:
After providing '--web.route-prefix':
│ Error parsing commandline arguments: [/bin/thanos tools bucket web --log.level=info --http-address=0.0.0.0:10902 --web.route-prefix=thanos/bucket --web.external-prefix=thanos/bucket --refresh=30m --objstore.config-file=/etc/thanos-store/ceph-object-storage.yaml]: unknown long flag '--we │
│ thanos: error: unknown long flag '--web.route-prefix' │
│ stream closed
Anything else we need to know:
I see a similar issue with compact web #2727. If it is fixed then bucket web UI can be fixed easily.
Thanks for reporting, it's a bug, help wanted to fix it. (:
hello, can I take a look into it?
@fagossa Yeah sure. Please go ahead.
What is the status of the issue? Is it alright to take it?
hello @aribalam , I'm new to this project so I'm having a hard time testing. If you have the time please go ahead!
Anyways I was looking to this place in bucket.go#L53 where there is a missing / between the prefix and the resource name, which might result in a 404. But again, hard time testing it
instrf := func(name string, next func(w http.ResponseWriter, r *http.Request)) http.HandlerFunc {
return ins.NewHandler(b.externalPrefix + "/" + name, http.HandlerFunc(next))
}
@fagossa I think still it will error out for unknown flag web.route-prefix.
While looking in query.go, I found something relative.
if webRoutePrefix != "/" {
router.Get("/", func(w http.ResponseWriter, r *http.Request) {
http.Redirect(w, r, webRoutePrefix+"/graph", http.StatusFound)
})
router.Get(webRoutePrefix, func(w http.ResponseWriter, r *http.Request) {
http.Redirect(w, r, webRoutePrefix+"/graph", http.StatusFound)
})
router = router.WithPrefix(webRoutePrefix)
}
I think this logic might be helpful.
@dmilind You are right. The router is not getting prefixed with the web.external-prefix string. Plus, there was another issue that the bucket.html template file did not have a proper link to the new UI. Will open a PR soon.
Any update on this?
Most helpful comment
@dmilind You are right. The router is not getting prefixed with the
web.external-prefixstring. Plus, there was another issue that thebucket.htmltemplate file did not have a proper link to the new UI. Will open a PR soon.