Cannot make Chronograf work behind Traefik reverse proxy

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