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

Compact: cli arg web.external-prefix is ignored #3156

Closed
gburek-fastly opened this issue Sep 11, 2020 · 3 comments · Fixed by #3184
Closed

Compact: cli arg web.external-prefix is ignored #3156

gburek-fastly opened this issue Sep 11, 2020 · 3 comments · Fixed by #3184

Comments

@gburek-fastly
Copy link

Thanos, Prometheus and Golang version used:

thanos, version 0.15.0 (branch: HEAD, revision: fbd14b4)
build user: root@d35b081d3e19
build date: 20200907-09:29:21
go version: go1.14.2

Object Storage Provider: GCS

What happened:
When thanos compact is run with --web.external-prefix=bucket-web, the NewBucketUI is not mounted on the supplied subpath, but the embedded hrefs and src links are correctly prefixed.

$ curl -s http://127.0.0.1:9090/bucket-web/global/ | head
404 page not found
$ curl -s http://127.0.0.1:9090/global/ | head
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <meta name="robots" content="noindex,nofollow">
        <title>Thanos long term storage Prometheus solution</title>
        <link rel="shortcut icon" href="/bucket-web/global/static/img/favicon.ico?v=fbd14b49f95e7543883fedf9381a21127d4dda2b">
        <script src="/bucket-web/global/static/vendor/js/jquery-3.5.0.min.js?v=fbd14b49f95e7543883fedf9381a21127d4dda2b"></script>
        <script src="/bucket-web/global/static/vendor/js/popper.min.js?v=fbd14b49f95e7543883fedf9381a21127d4dda2b"></script>
        <script src="/bucket-web/global/static/vendor/bootstrap-4.1.3/js/bootstrap.min.js?v=fbd14b49f95e7543883fedf9381a21127d4dda2b"></script>

What you expected to happen:
When thanos compact is run with --web.external-prefix=bucket-web, the NewBucketUI is mounted on the supplied subpath and curl -s http://127.0.0.1:9090/bucket-web/global/ | head results in a successful bucket ui page request.

How to reproduce it (as minimally and precisely as possible):

  1. run thanos compact with --http-address=127.0.0.1:9090 --wait --web.external-prefix=bucket-web
  2. run curl -s http://127.0.0.1:9090/bucket-web/global/ and observe 404 error

Anything else we need to know:

https://github.com/thanos-io/thanos/blob/master/cmd/thanos/config.go#L152-L156

It appears that the cmd.Flags for "web.external-prefix" and "web.prefix-header" use the same var reference to &wc.externalPrefix.

cmd.Flag(("web.prefix-header", "...").Default("").StringVar(&wc.externalPrefix) should use the prefixHeaderName var instead.

@yeya24
Copy link
Contributor

yeya24 commented Sep 13, 2020

Good catch! @gburek-fastly Do you want to create a pr to fix it?

@daksh-sagar
Copy link
Contributor

Hey, @yeya24. Can I take this up, if it's alright?

@yeya24
Copy link
Contributor

yeya24 commented Sep 17, 2020

@daksh-sagar Hi, feel free to take it. Thanks 😄

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

Successfully merging a pull request may close this issue.

3 participants