I try to use traefik as a reverse proxy for grafana. I want to route the requests coming to localhost/grafana to grafana. Here is my that part of docker compose file:
grafana:
image: grafana/grafana:9.4.2
ports:
- "3000:3000"
volumes:
- ./grafana/provisioning/:/etc/grafana/provisioning/
environment:
- GF_INSTALL_PLUGINS=grafana-piechart-panel
- GF_SECURITY_ADMIN_USER=admin
- GF_SECURITY_ADMIN_PASSWORD=admin
- GF_SERVER_DOMAIN=localhost
- GF_SERVER_ROOT_URL=http://localhost
labels:
- "traefik.http.routers.grafana.rule=(Host(`localhost`) && Path(`/grafana`))"
- "traefik.http.middlewares.routegrafana.replacepath.path=/"
- "traefik.http.routers.grafana.middlewares=routegrafana"
traefik:
image: traefik:v2.9
command: --api.insecure=true --providers.docker
ports:
- "80:80"
- "8080:8080"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
Is there something i am missing?
I tried to follow this tutorial: https://grafana.com/tutorials/run-grafana-behind-a-proxy/
But still could not do it. It gives me an error saying: 404 page not found.