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

Add support for InfluxDB behind reverse proxy under subpath (https://example.com/influxdb/) #5096

Closed
oddstr13 opened this issue Feb 24, 2019 · 16 comments · Fixed by #5940
Closed
Labels
Milestone

Comments

@oddstr13
Copy link

Currently (Chronograf 1.7.8), attempting to add a InfluxDB connection with Connection URL of https://example.com/influxdb/ results in a ping request to https://example.com/ping (path part of url is replaced, not appended to).

Desired behavior would be a request to https://example.com/influxdb/ping (path relative to supplied URL).

@russorat russorat added this to the 1.7.9 milestone Mar 11, 2019
@121watts 121watts assigned 121watts and unassigned 121watts Mar 14, 2019
@russorat russorat removed this from the 1.7.9 milestone Mar 18, 2019
@russorat
Copy link
Contributor

@oddstr13 We are having trouble reproducing this issue. Can you provide some additional details about your setup? When we check the code, it should be using the full url you enter in the source connection before adding the /ping. Are you still seeing this issue?

@oddstr13
Copy link
Author

This is the relevant part of my nginx server block;

    location /influxdb/ {
        proxy_pass http://localhost:8086/;
    }

Seeing as the application didn't even connect, I ended up digging into the influxdb command-line interface and syntax to do what I needed.
I have not used this application since my initial failed attempt, and as such cannot tell if the issue is still present or not.

@stale
Copy link

stale bot commented Jul 22, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jul 22, 2019
@stale
Copy link

stale bot commented Jul 29, 2019

This issue has been automatically closed because it has not had recent activity. Feel free to reopen if this issue is still important to you. Thank you for your contributions.

@stale stale bot closed this as completed Jul 29, 2019
@dontsovcmc
Copy link

dontsovcmc commented Dec 22, 2019

influx cli also unsupports path in url: influxdata/influxdb#10294
=(((

@russorat russorat reopened this Dec 30, 2019
@stale stale bot removed the stale label Dec 30, 2019
@camimartinez
Copy link

The issue is still happening at chronograf 1.8.8, i need to configure the influxdb behind a proxy reverse with a sub path like this: "https://myhost/influxdb" and it seems that chronograf is changing the url when is querying the influxdb "ping" endpoint (with a sub path), the logs show the following:

Failed to retrieve database version" error="<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n<html><head>\n<title>404 Not Found</title>\n</head><body>\n<h1>Not Found</h1>\n<p>The requested URL /ping was not found on this server.</p>\n<hr>\n<address>Apache/2.4.6 (Red Hat Enterprise Linux) OpenSSL/1.0.2k-fips Server at myhost Port 443</address>\n</body></html>\n

And after that the following error appears:
level=error msg="Error message Error contacting source" component=server http_status =400

Can you support the sub path? or any work around to this? Thank you.

@Forbzy
Copy link

Forbzy commented Feb 21, 2021

Hi All
What are the subpath configuration need in chronograf? When I load influxdb via browser I just see a white blank screen.

@DrPinguin98
Copy link

Hi All
What are the subpath configuration need in chronograf? When I load influxdb via browser I just see a white blank screen.

Yep, same with InfluxDB

@Forbzy
Copy link

Forbzy commented Feb 22, 2021 via email

@oddstr13
Copy link
Author

@russorat I can confirm that this is still an issue in Chronograf v1.9.0

@oddstr13
Copy link
Author

The culprit is likely to be lines such as this one; override path, not append to the configured path

u.Path = "ping"

A quick grep reveals the following locations where path is overridden, some of which are problematic;

chronograf$ grep '\.Path ?=[^=]' -RP .
./flux/client.go:	url.Path = "/api/v2/query"
./flux/client.go:	u.Path = "ping"
./influx/influx.go:	u.Path = "query"
./influx/influx.go:	u.Path = "api/v2/query"
./influx/influx.go:	u.Path = "ping"
./influx/influx.go:	u.Path = "write"
./oauth2/auth0.go:	domain.Path = "/authorize"
./oauth2/auth0.go:	domain.Path = "/oauth/token"
./oauth2/auth0.go:	domain.Path = "/userinfo"
./enterprise/meta.go:	URL.Path = path
./enterprise/meta_test.go:	URL.Path = path
./server/server.go:	redirectURL.Path = redirectPath
./server/server.go:	publicURL.Path = path.Join(publicURL.Path, s.Basepath, "oauth", genericName, "callback")
./server/influx.go:		u.Path = "/api/v2/write"
./server/influx.go:		u.Path = "/write"

I don't know Go, or whether the functions are passed a copy of the url, or a reference to the same object, so care may need to be taken not to end up with urls like https://example.com/influxdb/ping/write/query?foo=bar when fixing this issue.

@sranka
Copy link
Contributor

sranka commented Sep 28, 2021

Yes, a custom InfluxDB path is still not supported in 1.9.0 . The code still forgets the user-entered path and uses built-in API paths instead.

@tlifschitz
Copy link

tlifschitz commented Mar 26, 2022

Can somebody please make an effort to move forward with this feature? Im afraid i have no knowledge of Go. It a pitty not being able to access such a useful UI when running influx behind nginx and in a subpath.

@oddstr13
Copy link
Author

@sranka Thanks for looking into this!
I'm looking forward to testing out the next release 🙂

@sranka
Copy link
Contributor

sranka commented Jun 21, 2022

@oddstr13 you can already give it a try with a chronograf nightly build that can be downloaded from https://portal.influxdata.com/downloads/

@oddstr13
Copy link
Author

Tested the docker image, seems to be working fine.
Thanks for fixing the issue! 😃

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

Successfully merging a pull request may close this issue.

9 participants