简体   繁体   中英

Access InfluxDB 2 through Traefik via subdomain

I've installed Traefik and InfluxDB on docker, and am trying to configure Traefik to act as a reverse proxy for all InfluxDB requests via a subdomain eg https://influxdb.mydomain.com .

The InfluxDB labels I have are:

- traefik.enable=true
- traefik.http.routers.influxdb.entryPoints=websecure
- traefik.http.routers.influxdb.rule=Host(`influxdb.mydomain.com`)
- traefik.http.routers.influxdb.tls=true
- traefik.http.routers.influxdb.tls.certresolver=cloudflare
- traefik.http.services.influxdb.loadbalancer.server.port=8086

When accessing InfluxDB, I can see the page loading, but get a 404 on /api/v2/setup (when I inspect the network requests), so it doesn't load completely. All other resource load correctly eg /6588f709b0.js , /26.c9f12339d6.js , etc.

I can access InfluxDB via port 8086 without issues http://influxdb.mydomain.com:8086 .

Any idea what I might be missing to allow access to /api via Traefik?

Just posting a solution to my issue in case anyone else runs into a similar problem.

I had setup Traefik to route all /api requests to itself, since Traefik also has the /api endpoint, without specifying the Host . After specifying the Host for the Traefik container, /api requests get routed correctly to the influx sub-domain. Traefik Dashboard and InfluxDB are on different sub-domains.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM