Could not define the service name for the router: too many services

Hello together,

i'm using traefik 2.2 and have a problem with router and service definition to redirect to 2 different ports.

This the labels on the container:

################################################################################

  - "traefik.http.middlewares.traccar1m1.redirectscheme.scheme=https"
  - "traefik.http.middlewares.traccar1m1.redirectscheme.permanent=true"

  - "traefik.http.services.traccar1s1.loadbalancer.server.port=8082"

  - "traefik.http.routers.traccar1r1.rule=Host(`traccar.test.com`)"
  - "traefik.http.routers.traccar1r1.entrypoints=web"
  - "traefik.http.routers.traccar1r1.middlewares=traccar1m1"

  - "traefik.http.routers.traccar1r2.rule=Host(`traccar.test.com`)"
  - "traefik.http.routers.traccar1r2.service=traccar1s1"
  - "traefik.http.routers.traccar1r2.entrypoints=web-secure"
  - "traefik.http.routers.traccar1r2.tls=true"
  - "traefik.http.routers.traccar1r2.tls.certresolver=letsencrypt"

################################################################################

  - "traefik.http.middlewares.traccar2m1.redirectscheme.scheme=https"
  - "traefik.http.middlewares.traccar2m1.redirectscheme.permanent=true"

  - "traefik.http.services.traccar2s1.loadbalancer.server.port=5055"

  - "traefik.http.routers.traccar2r1.rule=Host(`traccar-client.test.com`)"
  - "traefik.http.routers.traccar2r1.entrypoints=web"
  - "traefik.http.routers.traccar2r1.middlewares=traccar2m1"

  - "traefik.http.routers.traccar2r2.rule=Host(`traccar-client.test.com`)"
  - "traefik.http.routers.traccar2r2.service=traccar2s1"
  - "traefik.http.routers.traccar2r2.entrypoints=web-secure"
  - "traefik.http.routers.traccar2r2.tls=true"
  - "traefik.http.routers.traccar2r2.tls.certresolver=letsencrypt"

################################################################################

If i'm using only one block of the both everthing works fine. If i use both i got this error

time="2020-04-14T11:48:37Z" level=error msg="Could not define the service name for the router: too many services" providerName=docker routerName=traccar2r1
time="2020-04-14T11:48:37Z" level=error msg="Could not define the service name for the router: too many services" providerName=docker routerName=traccar1r1

I need a hint whats wrong on my labe definitions.

Regards, Henry

Hello,

you have to set explicitly the service to each router.

  - "traefik.http.routers.traccar2r1.rule=Host(`traccar-client.test.com`)"
  - "traefik.http.routers.traccar2r1.entrypoints=web"
  - "traefik.http.routers.traccar2r2.service=traccar2s1"
  - "traefik.http.routers.traccar2r1.middlewares=traccar2m1"

  - "traefik.http.routers.traccar2r2.rule=Host(`traccar-client.test.com`)"
  - "traefik.http.routers.traccar2r2.service=traccar2s1"
  - "traefik.http.routers.traccar2r2.entrypoints=web-secure"
  - "traefik.http.routers.traccar2r2.tls=true"
  - "traefik.http.routers.traccar2r2.tls.certresolver=letsencrypt"
3 Likes

Hi,

thanks for the fast answer. It works now. :slight_smile:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.