I'm trying to configure Traefik for reverse proxying some requests to a container and to an external service, depending by the path prefix I use.
I'm using Docker Swarm.
On a service of mine, I have the following annotations:
- "traefik.enable=true" - "traefik.http.routers.portal.rule=Host(`myhost-dev.domain.it`) && PathPrefix(`/TestPath/`)" - "traefik.http.services.service-name.loadbalancer.server.port=80"
Everything works fine, if I access the endpoint http://myhost-dev.domain.it/TestPath/ the request is correctly forwarded to the container named "service-name" specified in my docker-compose.
Now I want to configure a new path, but this path shoud forward the request to an external service.
So I added the following annotations (in addition to the previous ones):
- "traefik.http.routers.external-service.rule=Host(`myhost-dev.domain.it`) && PathPrefix(`/TestPath2/`)" - "traefik.http.routers.external-service.service=external-service" - "traefik.http.services.external-service.loadbalancer.servers.url=http://10.64.9.106"
Everything stopped working. It's like the second set of rules override the first set, in the dashboard I see the first Router disappears and the second one is not there.
If I configure Traefik with an additional configuration file, it works instead:
http: routers: external-service: entryPoints: - web - web-secure service: external-service rule: Host(`myhost-dev.domain.it`) && Path(`/TestPath2/`) services: external-service: loadBalancer: servers: - url: http://10.64.9.106
What I'm doing wrong?