Search code examples
dockerinfluxdbtraefikinfluxdb-2

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 e.g. 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 e.g. /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?


Solution

  • 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.