Two entrypoints / services for one hostname

Trying to work out why this isn't working. I'm sure I've done this before! Error is:

ERR Router nodered cannot be linked automatically with multiple Services: ["nodered" "nr"] providerName=docker routerName=nodered

(and then vice versa):

ERR Router nr cannot be linked automatically with multiple Services: ["nodered" "nr"] providerName=docker routerName=nr

This is my docker-compose (https is port 443 and admin-secure is on port 3443)

services:
    node-red:
        image: nodered/node-red:latest
        container_name: node-red
        environment:
            - NODE_RED_ENABLE_PROJECTS=true
        volumes:
            - nodered_data:/data
        expose:
            - 1880
            - 3000
        labels:
            traefik.enable: true
            traefik.docker.network: proxy

            # ui
            traefik.http.routers.nodered.rule: Host(`nr.example.com`)
            traefik.http.routers.nodered.tls: true
            traefik.http.routers.nodered.tls.certresolver: myprovider
            traefik.http.routers.nodered.entrypoints: admin-secure

            traefik.http.services.nodered.loadbalancer.server.port: 1880

            # webhooks
            traefik.http.routers.nr.rule: Host(`nr.example.com`)
            traefik.http.routers.nr.tls: true
            traefik.http.routers.nr.tls.certresolver: myprovider
            traefik.http.routers.nr.entrypoints: https

            traefik.http.services.nr.loadbalancer.server.port: 3000

        restart: unless-stopped
        networks:
            - proxy
volumes:
    nodered_data:

networks:
    proxy:
        external: true

What am I doing wrong here?

Try to assign the service to the router, for each router.

Router and service can have the same name.

No difference unfortunately :frowning:

Share your compose file again. Note that you don’t need expose, as that’s just an indicator and you set loadbalancer.server.port.

This is my full config now (with only the host rule's domain changed). There's a couple of other bits in there for websockets which I believe I need, but I have tried without them also...

services:
    node-red:
        image: nodered/node-red:latest
        container_name: node-red
        environment:
            - NODE_RED_ENABLE_PROJECTS=true
        volumes:
            - nodered_data:/data
        labels:
            traefik.enable: true
            traefik.docker.network: proxy
            traefik.http.middlewares.websocket.headers.customrequestheaders.X-Forwarded-Proto: https
            traefik.http.middlewares.websocket.headers.customresponseheaders.Access-Control-Allow-Origin: '*'

            # ui
            traefik.http.routers.nodered.rule: Host(`nr.example.com`)
            traefik.http.routers.nodered.tls: true
            traefik.http.routers.nodered.tls.certresolver: myprovider
            traefik.http.routers.nodered.entrypoints: admin-secure
            traefik.http.routers.nodered.middlewares: forward-headers@file

            traefik.http.services.nodered.loadbalancer.server.port: 1880
            traefik.http.services.nodered.loadBalancer.sticky.cookie.name: server_id
            traefik.http.services.nodered.loadBalancer.sticky.cookie.httpOnly: true

            # webhooks
            traefik.http.routers.nr.rule: Host(`nr.example.com`)
            traefik.http.routers.nr.tls: true
            traefik.http.routers.nr.tls.certresolver: myprovider
            traefik.http.routers.nr.entrypoints: https
            traefik.http.routers.nr.service: nr

            traefik.http.services.nr.loadbalancer.server.port: 3000

        restart: unless-stopped
        networks:
            - proxy
volumes:
    nodered_data:
networks:
    proxy:
        external: true

Maybe you solved the Problem already, but for the other People coming here (like :sweat_smile:) having the same Issue, I think you missed what @bluepuma77 Mentioned (it's NOT in your latest Config File).

Specifically EXPLICITELY associating the FIRST Router with the FIRST Service. I don't think this was Required on Traefik v2 ...

I usually prefer to be VERY explicit and avoid Name Conflicts between Service and Router though:

- "traefik.http.routers.nodered-main-router.service=nodered-main-service@docker"

As soon as I fixed this (and REMOVED the Entrypoints associations for each Router) it started working correctly.

The Explicit Entrypoints definition for each Router seems to always throw traefik out of balance for some Reason:

Error while starting server error="accept tcp [::]:443: use of closed network connection" entryPointName=websecure
Error while starting server error="accept tcp [::]:3012: use of closed network connection" entryPointName=websocketsecure