Hey, I've been diving deep into Traefik configurations, especially regarding path-based routing. While many community members have found success with strip prefix middleware, my aim is to achieve path-based routing directly.
Check out this discussion thread where they discuss strip prefix middleware: traefik-is-unable-to-strip-prefix-before-forwarding-request-to-a-service
However, my goal remains fixed on implementing path-based routing. It's crucial for my project, so I'm determined to make it work even with using StripPrefix. Let's keep pushing forward until we crack this!
here is my docker-compose.yml:
version: "3"
services:
traefik:
image: 'traefik:v2.7'
container_name: 'traefik'
# network_mode: 'host'
command:
- "--api.insecure=true"
- '--accesslog=true'
- "--providers.docker"
- "--log.level=DEBUG"
- "--entrypoints.web.address=:80"
- "--entrypoints.websecure.address=:443"
- "--providers.docker.exposedByDefault=false"
# - "--providers.docker.endpoint=unix:///var/run/docker.sock"
# - "--providers.docker.useBindPortIP=true"
ports:
- "80:80"
- "443:443"
- "8080:8080"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
grafana:
image: grafana/grafana
container_name: grafana
ports:
- "6060:3000"
labels:
- "traefik.enable=true"
- "traefik.http.routers.grafana.rule=(Host(`localhost`) && Path(`/grafana`))"
- "traefik.http.routers.grafana.entrypoints=web"
- "traefik.http.routers.grafana.service=grafana"
- "traefik.http.middlewares.grafana-stripprefix.stripprefix.prefixes=/grafana"
- "traefik.http.routers.grafana.middlewares=grafana-stripprefix"
- "traefik.http.services.grafana.loadbalancer.server.port=3000"