Hi, I've chosen a web service like Grafana to test a reverse proxy configuration in which there is a router rule PathPrefix.
What I would like to accomplish:
- The user navigates to https://mydomain/grafana
- Traefik routes the request to http://grafana:3000
- As grafana uses some subpaths on its own (like on the login page, which is http://grafana:3000/login) I would like that everything would take place under the subpath "grafana" (e.g. https://mydomain/grafana/login)
This is the (not working) config I've put together:
docker-compose.yml
version: "3.3"
services:
traefik:
image: "traefik:latest"
container_name: "traefik"
ports:
- "80:80"
- "443:443"
- "8080:8080"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
- "$PWD/traefik.yml:/etc/traefik/traefik.yml"
- "$PWD/providers.yml:/etc/traefik/providers.yml"
grafana:
image: "grafana/grafana"
container_name: "grafana"
labels:
- "traefik.enable=true"
volumes:
- "$PWD/grafana.ini:/etc/grafana/grafana.ini"
traefik.yml
log:
level: DEBUG
api:
dashboard: true
insecure: true
providers:
docker:
exposedByDefault: false
file:
filename: "/etc/traefik/providers.yml"
watch: true
entryPoints:
web:
address: ":80"
http:
redirections:
entryPoint:
to: websecure
scheme: https
websecure:
address: ":443"
providers.yml
http:
routers:
to-secure-grafana:
rule: "PathPrefix(`/grafana`)"
entryPoints: websecure
service: grafana
tls: {}
services:
grafana:
loadBalancer:
servers:
- url: "http://grafana:3000"
What happens here (I think) is that the redirection occurs but then the path is no more with the prefix "grafana". I've also tried some configurations adopting middlewares with ReplacePath and StripPrefix, but with no luck.
Do you think there is a way to accomplish my need without touching the configuration of the service itself?