Cannot make Chronograf work behind Traefik reverse proxy

Steps to reproduce:
List the minimal actions needed to reproduce the behavior.

  1. Launch docker container using official Chronograf image
  2. Launch Traefik container to be used as reverse proxy
  3. Setup reverse proxy for Chronograf

Expected behavior:
Chronograf opens in a web browser using address “https://mydomain.com/chronograf

Actual behavior:

A blank page opens, see screenshot

Environment info:

  • Chronograf version:
    chronograf:1.8.7 official docker image from docker hub.

Config:

  1. /etc/default/chronograf file mounted inside the container with the following content:
CHRONOGRAF_OPTS=--basepath /chronograf
  1. Traefik tags for Chronograf docker container
tags = [
  "traefik.enable=true",
  "traefik.http.routers.chronograf-https.tls=true",
  "traefik.http.routers.chronograf-https.rule=Host(`{{base_url}}`) && PathPrefix(`/chronograf`)",
  "traefik.http.routers.chronograf-https.entrypoints=websecure",
  "traefik.http.routers.chronograf-https.middlewares=chronograf-auth",
  # Basic auth
  "traefik.http.middlewares.chronograf-auth.basicauth.users={{basic_auth_htpasswd}}",
]

When I empty the /etc/default/chronograf file and change rule to

"traefik.http.routers.chronograf-https.rule=Host(`{{base_url}}`)",

then page loads up properly when I try just the address https://mydomain.com without any paths, see screenshot

So this means my environment is good and it is just a matter of either Traefik tags being wrong for Chronograf or Chronograf docker container being misconfigured. What may I be doing wron

Hello @MGasztold,
Can you share your docker compose?

Hello eventually I made it work.

My working configuration of docker container and Traefik tags is:

tags = [
  "traefik.enable=true",
  "traefik.http.routers.chronograf-https.tls=true",
  "traefik.http.routers.chronograf-https.rule=Host(`{{base_url}}`) && (PathPrefix(`/chronograf`) || PathPrefix(`/chronograf/{.*}`))",
  "traefik.http.routers.chronograf-https.entrypoints=websecure",
  "traefik.http.routers.chronograf-https.service=chronograf",
  "traefik.http.routers.chronograf-https.middlewares=chronograf-auth",
  # Basic auth
  "traefik.http.middlewares.chronograf-auth.basicauth.users={{basic_auth_htpasswd}}",
  "traefik.http.middlewares.chronograf-strip.stripprefix.prefixes=/chronograf"
]

and

task "chronograf" {
	driver = "docker"
	config {
		image = "chronograf:1.8.7"
		ports = ["chronograf-api"]
		dns_servers = ["${attr.unique.network.ip-address}"]
		volumes = [
			"/storage-pool/Analytics-files/chronograf/data/chronograf:/var/lib/chronograf"
		]
		entrypoint = [
			"chronograf", "--influxdb-url=http://influxdb.service.consul:8086", "--kapacitor-url=http://kapacitor.service.consul:9092"
		]
	}
	env {
		BASE_PATH = "/chronograf"
	}
}

Maybe this will save time for somebody.

1 Like

Hello @MGasztold
Thank you for sharing your solution!!