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

Support for --web.external-url and --web.route-prefix in 0.15.0 is incomplete #519

Closed
siebenmann opened this issue Sep 11, 2019 · 2 comments · Fixed by #520
Closed

Support for --web.external-url and --web.route-prefix in 0.15.0 is incomplete #519

siebenmann opened this issue Sep 11, 2019 · 2 comments · Fixed by #520

Comments

@siebenmann
Copy link
Contributor

Host operating system: output of uname -a

Linux hawkwind.cs 5.2.11-200.fc30.x86_64 #1 SMP Thu Aug 29 12:43:20 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

blackbox_exporter version: output of blackbox_exporter -version

blackbox_exporter, version 0.15.0 (branch: HEAD, revision: 3f726a8)
build user: root@3280fda7d3fc
build date: 20190911-12:52:20
go version: go1.12.9

The problem

If you run Blackbox with the new --web.external-url and --web.route-prefix options to try to operate it behind a reverse proxy, Blackbox's front page HTML still produces incorrect absolute links for the links to logs for probes, instead of either relative links or correct absolute links that use the external URL you set.

Looking at the code in commit 252a878, I think it should be prefixing these links with *externalURL instead of *routePrefix or simply leaving them as relative links. As I understand the settings, --web.route-prefix is the prefix that Blackbox sees in the requests from the front-end server, while --web.external-url is the external address, so visible URLs should always be generated using the latter (while being matched through the former).

What did you do that produced an error?

Run blackbox_exporter --config.file blackbox.yml --web.external-url=https://example.org/blackbox/ --web.route-prefix=/, make a probe (eg curl "localhost:9115/probe?module=http_2xx&target=https://google.com/"), and then look at the HTML for Blackbox's front page. In the HTML, logs for probes will be linked as eg <a href='/logs?id=0'>Logs</a>, which is an incorrect external URL (it should be /blackbox/logs?id=0, even without the host).

@brian-brazil
Copy link
Contributor

The links are meant to be all relative. Would you like to send a PR?

siebenmann added a commit to siebenmann/blackbox_exporter that referenced this issue Sep 11, 2019
The front page contains a table of links to logs from the most recent
probes. These links were accidentally changed to absolute links in
252a878, in a form that doesn't work when using --web.external-url.
Rather than prefixing these with the external URL (if set), we return
them to being relative links, as they are meant to be (per issue prometheus#519).

Fixes prometheus#519

Signed-off-by: Chris Siebenmann <[email protected]>
@snebel29
Copy link
Contributor

snebel29 commented Sep 11, 2019

I'm sorry to hear that @siebenmann, as you already noticed the following line missed the update back to relative path.

Once I get home I will triple check everything and post the test scenarios to ensure this is working as expected, adding testing for that area may have helped.

brian-brazil pushed a commit that referenced this issue Sep 11, 2019
The front page contains a table of links to logs from the most recent
probes. These links were accidentally changed to absolute links in
252a878, in a form that doesn't work when using --web.external-url.
Rather than prefixing these with the external URL (if set), we return
them to being relative links, as they are meant to be (per issue #519).

Fixes #519

Signed-off-by: Chris Siebenmann <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants