Routers rules and 2 competing docker containers

I would like to add another docker container to an existing traefik environment. The first app handles all http and https requests with the following docker-compose configuration:

  - "traefik.enable=true"
  - "traefik.http.routers.lime-https.rule=Host(``)"
  - "traefik.http.routers.lime-http.rule=Host(``)"
  - "traefik.http.middlewares.redirect.redirectscheme.scheme=https"
  - "traefik.http.middlewares.redirect.redirectscheme.permanent=true"
  - "traefik.http.routers.lime-http.middlewares=redirect"
  - "traefik.http.routers.lime-https.entrypoints=websecure"
  - "traefik.http.routers.lime-http.entrypoints=web"
  - "traefik.http.routers.lime-https.tls.certresolver=myresolver"
  - web

I would like to add the second app, which would be targeted by However, the following configuration does not work. Still the first app responses with 404 error:

  - "traefik.enable=true"
  - "traefik.http.routers.xnat.rule=PathPrefix(`/xnat/`)"
  - "traefik.http.routers.xnat.entrypoints=websecure"
  - "traefik.http.routers.xnat.priority=1"
  - ""
  - "traefik.http.routers.xnat.service=xnat-service"
  - web

Please let me know how to solve the problem.

Hello @malywladek,

From the documentation: (, priority is an ordered number.

Therefore priority 100 will match before priority 1.

By setting your second service to a priority of 1, every other service will be matched first.

Try it with a priority of 100.

Thank You for the quick reply but the change of priority does not help.

I assume this is a typo and should be /xnat/

  • Your routers lime-https and xnat need tls enabled.
  • The priority was an issue.
  • You likely want a (Host(``) && Path(`/xnat/`)) rule.
  • traefik.http.routers.xnat.service is not required, it is implicit from the docker service/container

Thank You for the responses. Indeed I have copied configuration from the first app and modified the names. Also I have added priority and it seems to work. However, I have an additional question regarding my application. What if redirects to eg. for authorisation. Can Traefik handle such requests?

The app is sending the redirect? Update an existing rule to match it or add a new route/service.

Same app handles uri
.....rule=(Host(``) && (Path(`/xnat/`) || Path(`/login`)) )

If another service does /login then the same pattern of adding traefik labels for a new router.